Search Results for

    Show / Hide Table of Contents

    Class NpgsqlException

    The exception that is thrown when server-related issues occur.

    Inheritance
    object
    NpgsqlException
    NpgsqlOperationInProgressException
    PostgresException
    Namespace: Npgsql
    Assembly: Npgsql.dll
    Syntax
    public class NpgsqlException : DbException
    Remarks

    PostgreSQL errors (e.g. query SQL issues, constraint violations) are raised via PostgresException which is a subclass of this class. Purely Npgsql-related issues which aren't related to the server will be raised via the standard CLR exceptions (e.g. ArgumentException).

    Constructors

    | Improve this Doc View Source

    NpgsqlException()

    Initializes a new instance of the NpgsqlException class.

    Declaration
    public NpgsqlException()
    Remarks

    PostgreSQL errors (e.g. query SQL issues, constraint violations) are raised via PostgresException which is a subclass of this class. Purely Npgsql-related issues which aren't related to the server will be raised via the standard CLR exceptions (e.g. ArgumentException).

    | Improve this Doc View Source

    NpgsqlException(SerializationInfo, StreamingContext)

    Initializes a new instance of the NpgsqlException class with serialized data.

    Declaration
    protected NpgsqlException(SerializationInfo info, StreamingContext context)
    Parameters
    Type Name Description
    SerializationInfo info

    The SerializationInfo that holds the serialized object data about the exception being thrown.

    StreamingContext context

    The StreamingContext that contains contextual information about the source or destination.

    Remarks

    PostgreSQL errors (e.g. query SQL issues, constraint violations) are raised via PostgresException which is a subclass of this class. Purely Npgsql-related issues which aren't related to the server will be raised via the standard CLR exceptions (e.g. ArgumentException).

    | Improve this Doc View Source

    NpgsqlException(string?, Exception?)

    Initializes a new instance of the NpgsqlException class with a specified error message and a reference to the inner exception that is the cause of this exception.

    Declaration
    public NpgsqlException(string? message, Exception? innerException)
    Parameters
    Type Name Description
    string? message

    The error message that explains the reason for the exception.

    Exception? innerException

    The exception that is the cause of the current exception, or a null reference (Nothing in Visual Basic) if no inner exception is specified.

    Remarks

    PostgreSQL errors (e.g. query SQL issues, constraint violations) are raised via PostgresException which is a subclass of this class. Purely Npgsql-related issues which aren't related to the server will be raised via the standard CLR exceptions (e.g. ArgumentException).

    | Improve this Doc View Source

    NpgsqlException(string?)

    Initializes a new instance of the NpgsqlException class with a specified error message.

    Declaration
    public NpgsqlException(string? message)
    Parameters
    Type Name Description
    string? message

    The message that describes the error.

    Remarks

    PostgreSQL errors (e.g. query SQL issues, constraint violations) are raised via PostgresException which is a subclass of this class. Purely Npgsql-related issues which aren't related to the server will be raised via the standard CLR exceptions (e.g. ArgumentException).

    Properties

    | Improve this Doc View Source

    BatchCommand

    If the exception was thrown as a result of executing a DbBatch, references the DbBatchCommand within the batch which triggered the exception. Otherwise null.

    Declaration
    public NpgsqlBatchCommand? BatchCommand { get; set; }
    Property Value
    Type Description
    NpgsqlBatchCommand
    Remarks

    PostgreSQL errors (e.g. query SQL issues, constraint violations) are raised via PostgresException which is a subclass of this class. Purely Npgsql-related issues which aren't related to the server will be raised via the standard CLR exceptions (e.g. ArgumentException).

    | Improve this Doc View Source

    IsTransient

    Specifies whether the exception is considered transient, that is, whether retrying the operation could succeed (e.g. a network error or a timeout).

    Declaration
    public virtual bool IsTransient { get; }
    Property Value
    Type Description
    bool
    Remarks

    PostgreSQL errors (e.g. query SQL issues, constraint violations) are raised via PostgresException which is a subclass of this class. Purely Npgsql-related issues which aren't related to the server will be raised via the standard CLR exceptions (e.g. ArgumentException).

    • Improve this Doc
    • View Source
    In This Article
    Back to top © Copyright 2023 The Npgsql Development Team