Show / Hide Table of Contents

Class NpgsqlException

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

Inheritance
System.Object
System.Exception
System.SystemException
System.Runtime.InteropServices.ExternalException
System.Data.Common.DbException
NpgsqlException
PostgresException
Implements
System.Runtime.Serialization.ISerializable
System.Runtime.InteropServices._Exception
Inherited Members
System.Runtime.InteropServices.ExternalException.ToString()
System.Runtime.InteropServices.ExternalException.ErrorCode
System.Exception.GetBaseException()
System.Exception.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)
System.Exception.GetType()
System.Exception.Message
System.Exception.Data
System.Exception.InnerException
System.Exception.TargetSite
System.Exception.StackTrace
System.Exception.HelpLink
System.Exception.Source
System.Exception.HResult
System.Exception.SerializeObjectState
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.MemberwiseClone()
Namespace: Npgsql
Assembly: Npgsql.dll
Syntax
[Serializable]
public class NpgsqlException : DbException, ISerializable, _Exception
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

NpgsqlException()

Initializes a new instance of the NpgsqlException class.

Declaration
public NpgsqlException()

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
System.Runtime.Serialization.SerializationInfo info

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

System.Runtime.Serialization.StreamingContext context

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

NpgsqlException(String)

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

Declaration
public NpgsqlException(string message)
Parameters
Type Name Description
System.String message

The message that describes the error.

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
System.String message

The error message that explains the reason for the exception.

System.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.

Properties

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
System.Boolean

Implements

System.Runtime.Serialization.ISerializable
System.Runtime.InteropServices._Exception
In This Article
Back to top Generated by DocFX