DataAction / AdoNetCore.AseClient

AdoNetCore.AseClient - a .NET Core DB Provider for SAP ASE
Apache License 2.0
107 stars 45 forks source link

Error item in ErrorCollection is not the same order as the legacy driver #185

Closed ngvtien closed 4 years ago

ngvtien commented 4 years ago

Describe the bug Error item in AseErrorCollection is not the same order as the legacy driver

To Reproduce If you got a stored proc that after it got call produces the following errors (both custom and generic) [1] RecordNotFound (Severity:16) => A customer could not be found [2] RecordNotFound (Severity:16) => A customer could not be found [3] AseException (Severity:16) => Attempt to insert NULL value into column 'xyz' [4] AseException (Severity:10) => Command has been aborted.

The current behavior sort the error with greater severity on top which is right but it doesn't respect ones that have the same severity level. So the above list returned as follow which is not consistence with the legacy driver [3] AseException (Severity:16) => Attempt to insert NULL value into column 'xyz' [2] RecordNotFound (Severity:16) => A customer could not be found [1] RecordNotFound (Severity:16) => A customer could not be found [4] AseException (Severity:10) => Command has been aborted.

Expected behavior If the level of severity is the same and already in the right order like in this case then we shouldn't have to swap them [1] RecordNotFound (Severity:16) => A customer could not be found [2] RecordNotFound (Severity:16) => A customer could not be found [3] AseException (Severity:16) => Attempt to insert NULL value into column 'xyz' [4] AseException (Severity:10) => Command has been aborted.

Environment

Additional context Line 68 in the GetIndexOfMostSevereError method of the AseErrorCollection.cs class the compare operator should be a < (less than) and not a <= (less than or equal to)