<PackageReference Include="System.Data.SqlClient" Version="4.8.0-preview2.19523.17" />

SqlError

public sealed class SqlError
Collects information relevant to a warning or error returned by SQL Server.
public byte Class { get; }

Gets the severity level of the error returned from SQL Server.

public int LineNumber { get; }

Gets the line number within the Transact-SQL command batch or stored procedure that contains the error.

public string Message { get; }

Gets the text describing the error.

public int Number { get; }

Gets a number that identifies the type of error.

public string Procedure { get; }

Gets the name of the stored procedure or remote procedure call (RPC) that generated the error.

public string Server { get; }

Gets the name of the instance of SQL Server that generated the error.

public string Source { get; }

Gets the name of the provider that generated the error.

public byte State { get; }

Some error messages can be raised at multiple points in the code for the Database Engine. For example, an 1105 error can be raised for several different conditions. Each specific condition that raises an error assigns a unique state code.