pub struct ErrorReport { /* private fields */ }Expand description
Represents the set of information necessary for pgrx to promote a Rust panic!() to a Postgres
ERROR (or any PgLogLevel level)
Implementations§
Source§impl ErrorReport
impl ErrorReport
Sourcepub fn new<S: Into<Cow<'static, str>>>(
sqlerrcode: PgSqlErrorCode,
message: S,
funcname: &'static str,
) -> Self
pub fn new<S: Into<Cow<'static, str>>>( sqlerrcode: PgSqlErrorCode, message: S, funcname: &'static str, ) -> Self
Create an ErrorReport which can be raised via Rust’s std::panic::panic_any() or as a specific Postgres “ereport()` level via [ErrorReport::unwrap_or_report(self, PgLogLevel)]
Embedded “file:line:col” location information is taken from the caller’s location
Sourcepub fn set_detail<S: Into<String>>(self, detail: S) -> Self
pub fn set_detail<S: Into<String>>(self, detail: S) -> Self
Set the detail property, whose default is None
Sourcepub fn set_hint<S: Into<String>>(self, hint: S) -> Self
pub fn set_hint<S: Into<String>>(self, hint: S) -> Self
Set the hint property, whose default is None
Sourcepub fn set_domain<S: Into<String>>(self, domain: S) -> Self
pub fn set_domain<S: Into<String>>(self, domain: S) -> Self
Set the domain property for message translation/internationalization, whose default is None.
This corresponds to the domain argument in Postgres’ ereport_domain C macro.
When set, the domain is passed to errstart() to indicate the gettext text domain
for message translation.
Sourcepub fn report(self, level: PgLogLevel)
pub fn report(self, level: PgLogLevel)
Report this ErrorReport, which will ultimately be reported by Postgres at the specified PgLogLevel
If the provided level is >= PgLogLevel::ERROR this function will not return.