Skip to content

Commit

Permalink
gate on pretty error
Browse files Browse the repository at this point in the history
Signed-off-by: Bugen Zhao <[email protected]>
  • Loading branch information
BugenZhao committed Nov 6, 2023
1 parent 4d6e7c5 commit 8b89b22
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/utils/pgwire/src/pg_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use std::io::{Error, ErrorKind, IoSlice, Result, Write};
use byteorder::{BigEndian, ByteOrder};
/// Part of code learned from <https://github.com/zenithdb/zenith/blob/main/zenith_utils/src/pq_proto.rs>.
use bytes::{Buf, BufMut, Bytes, BytesMut};
use risingwave_common::util::env_var::env_var_is_true;
use tokio::io::{AsyncRead, AsyncReadExt};

use crate::error_or_notice::ErrorOrNoticeMessage;
Expand Down Expand Up @@ -634,7 +635,11 @@ impl<'a> BeMessage<'a> {

// 'E' signalizes ErrorResponse messages
buf.put_u8(b'E');
let msg = format!("{:#}", error.as_ref().as_report());
let msg = if env_var_is_true("RW_PRETTY_ERROR") {
format!("{:#}", error.as_ref().as_report())
} else {
format!("{}", error.as_ref().as_report())
};
write_err_or_notice(buf, &ErrorOrNoticeMessage::internal_error(&msg))?;
}

Expand Down

0 comments on commit 8b89b22

Please sign in to comment.