Skip to content

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, ISerializable

Inheritance: object, Exception

Implements: ISerializable

Creates an external-routine error with a default message.

public PgException()

Creates an external-routine error.

public PgException(string message)

Parameters:

message — string

The primary error message.

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.

Gets the native backtrace when PostgreSQL collected one for this error.

public string? Backtrace { get; init; }

Value: string

Gets the column associated with the error.

public string? ColumnName { get; init; }

Value: string

Gets the constraint associated with the error.

public string? ConstraintName { get; init; }

Value: string

Gets the PostgreSQL execution context, including SQL and procedural call frames when supplied by the server.

public string? Context { get; init; }

Value: string

Gets the data type associated with the error.

public string? DataTypeName { get; init; }

Value: string

Gets additional error detail.

public string? Detail { get; }

Value: string

Gets additional detail intended for the PostgreSQL server log rather than the client error response.

public string? DetailLog { get; init; }

Value: string

Gets whether allocating or encoding diagnostic transport failed, leaving only partially copied diagnostics.

public bool DiagnosticsIncomplete { get; }

Value: bool

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

Gets the one-based character position in InternalQuery, or zero when no internal position is supplied.

public int InternalPosition { get; init; }

Value: int

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

Gets the one-based character position in the client query, or zero when no position is supplied.

public int Position { get; init; }

Value: int

Gets the source routine that reported the error.

public string? Routine { get; init; }

Value: string

Gets the schema associated with the error.

public string? SchemaName { get; init; }

Value: string

Gets the PostgreSQL SQLSTATE code.

public string SqlState { get; }

Value: string

Gets the table associated with the error.

public string? TableName { get; init; }

Value: string