chore(postgres): include nullables query in error

This commit is contained in:
Austin Bonander
2024-08-21 13:50:48 -07:00
parent 4fb2dcbe97
commit 56d0225378
3 changed files with 19 additions and 8 deletions

View File

@@ -312,11 +312,16 @@ impl From<crate::migrate::MigrateError> for Error {
/// Format an error message as a `Protocol` error
#[macro_export]
macro_rules! err_protocol {
($expr:expr) => {
$crate::error::Error::Protocol($expr.into())
};
($fmt:expr, $($arg:tt)*) => {
$crate::error::Error::Protocol(format!($fmt, $($arg)*))
($($fmt_args:tt)*) => {
$crate::error::Error::Protocol(
format!(
"{} ({}:{})",
// Note: the format string needs to be unmodified (e.g. by `concat!()`)
// for implicit formatting arguments to work
format_args!($($fmt_args)*),
module_path!(),
line!(),
)
)
};
}