Table of Contents

Class SqlBatchErrorException

Namespace
ItTiger.TigerQuery
Assembly
ItTiger.TigerQuery.dll
Represents one or more SQL Server errors that the provider reported for a batch through informational-message delivery instead of throwing.
[Serializable]
public sealed class SqlBatchErrorException : Exception, ISerializable
Inheritance
SqlBatchErrorException
Implements
Inherited Members

Remarks

The engine enables FireInfoMessageEventOnUserErrors so that a script keeps running past a recoverable server error and every diagnostic reaches the message callback in order. As a result SQL Server user errors — severity 11 through 16, which is what RAISERROR and THROW normally produce — arrive as events rather than as a SqlException. This exception is the engine's representation of those errors so that a failed batch always carries a diagnostic, whichever transport the provider chose.

It is never thrown out of a run method. It appears as Exception for the failing attempt and, when that failure stops the run, as Exception. The individual server diagnostics remain available through Errors with their original number, severity, state, procedure, and line.

Constructors

SqlBatchErrorException()

Initializes an exception with no message and no server diagnostics.
public SqlBatchErrorException()

SqlBatchErrorException(string)

Initializes an exception with a message and no server diagnostics.
public SqlBatchErrorException(string message)

Parameters

message string
The error message.

SqlBatchErrorException(string, Exception)

Initializes an exception with a message and underlying exception.
public SqlBatchErrorException(string message, Exception inner)

Parameters

message string
The error message.
inner Exception
The exception that caused this failure.

Properties

Errors

Gets the server errors observed during the batch, in the order the provider reported them.
public IReadOnlyList<SqlCmdMessage> Errors { get; }

Property Value

IReadOnlyList<SqlCmdMessage>

Remarks

The same messages were already delivered to OnMessage; they are repeated here so the failure can be inspected without retaining the message stream.