PgException
Namespace: Ankus
Assembly: Ankus.Runtime.dll
Represents a PostgreSQL error raised by a guarded server call or deliberately reported by an extension.
public sealed class PgException : Exception, ISerializableInheritance: object, Exception
Implements: ISerializable
Constructors
Section titled “Constructors”PgException()
Section titled “PgException()”Creates an external-routine error with a default message.
public PgException()PgException(string)
Section titled “PgException(string)”Creates an external-routine error.
public PgException(string message)Parameters:
message — string
The primary error message.
PgException(string, Exception?)
Section titled “PgException(string, Exception?)”Creates an external-routine error with a managed cause.
public PgException(string message, Exception? innerException)Parameters:
message — string
The primary error message.
innerException — Exception
The original managed error.
PgException(string, string, string?, string?, Exception?)
Section titled “PgException(string, string, string?, string?, Exception?)”Creates an error with explicit PostgreSQL diagnostics.
public PgException(string sqlState, string message, string? detail = null, string? hint = null, Exception? innerException = null)Parameters:
sqlState — string
The five-character uppercase SQLSTATE code.
message — string
The primary error message.
detail — string
Additional error detail.
hint — string
A suggested corrective action.
innerException — Exception
The original managed error, if any.
Properties
Section titled “Properties”Backtrace
Section titled “Backtrace”Gets the native backtrace when PostgreSQL collected one for this error.
public string? Backtrace { get; init; }Value: string
ColumnName
Section titled “ColumnName”Gets the column associated with the error.
public string? ColumnName { get; init; }Value: string
ConstraintName
Section titled “ConstraintName”Gets the constraint associated with the error.
public string? ConstraintName { get; init; }Value: string
Context
Section titled “Context”Gets the PostgreSQL execution context, including SQL and procedural call frames when supplied by the server.
public string? Context { get; init; }Value: string
DataTypeName
Section titled “DataTypeName”Gets the data type associated with the error.
public string? DataTypeName { get; init; }Value: string
Detail
Section titled “Detail”Gets additional error detail.
public string? Detail { get; }Value: string
DetailLog
Section titled “DetailLog”Gets additional detail intended for the PostgreSQL server log rather than the client error response.
public string? DetailLog { get; init; }Value: string
DiagnosticsIncomplete
Section titled “DiagnosticsIncomplete”Gets whether allocating or encoding diagnostic transport failed, leaving only partially copied diagnostics.
public bool DiagnosticsIncomplete { get; }Value: bool
Domain
Section titled “Domain”Gets the message domain PostgreSQL recorded for this error, such as an extension’s own domain or PostgreSQL’s
postgres- domain, or null when it has not been reported.
public string? Domain { get; init; }Value: string
Gets the source file that reported the error.
public string? File { get; init; }Value: string
Gets a suggested corrective action.
public string? Hint { get; }Value: string
InternalPosition
Section titled “InternalPosition”Gets the one-based character position in InternalQuery, or zero when no internal position is supplied.
public int InternalPosition { get; init; }Value: int
InternalQuery
Section titled “InternalQuery”Gets the internally executed query associated with InternalPosition.
public string? InternalQuery { get; init; }Value: string
Gets the source line that reported the error, or zero when unavailable.
public int Line { get; init; }Value: int
Position
Section titled “Position”Gets the one-based character position in the client query, or zero when no position is supplied.
public int Position { get; init; }Value: int
Routine
Section titled “Routine”Gets the source routine that reported the error.
public string? Routine { get; init; }Value: string
SchemaName
Section titled “SchemaName”Gets the schema associated with the error.
public string? SchemaName { get; init; }Value: string
SqlState
Section titled “SqlState”Gets the PostgreSQL SQLSTATE code.
public string SqlState { get; }Value: string
TableName
Section titled “TableName”Gets the table associated with the error.
public string? TableName { get; init; }Value: string