Page 1 of 1

OracleException behavior

Posted: Tue 06 May 2014 12:22
by Dennis Wanke
The behavior of OracleException is inconsistent with that of SqlException. The OracleException's Errors property can be null, whereas the SqlException's one can never be null and always contains at least one entry. Moreover, SqlException.Message comprises all the messages from the Errors collection (separated with a new line), which OracleException doesn't:

Code: Select all

public SqlErrorCollection Errors
{
    get
    {
        if (this._errors == null)
            this._errors = new SqlErrorCollection();
        return this._errors;
    }
}

static SqlException CreateException(SqlErrorCollection errorCollection, ...)
{
    var stringBuilder = new StringBuilder();
    for (int index = 0; index < errorCollection.Count; ++index)
    {
        if (index > 0) stringBuilder.Append(Environment.NewLine);
        stringBuilder.Append(errorCollection[index].Message);
    }
    ... ...
    return new SqlException(((object) stringBuilder).ToString(), ...);
}
This differences can lead to hidden bugs when implementing error handling involving OracleException by persons who are familiar with "handling" SqlException (which actually doesn't require any special handling for bringing up all the messages, in opposite to OracleException).
So please consider making OracleException's behavior to be consistent with that of SqlException. Note, if message concatenation will be implemented, that only distinct messages should be taken, in order to suppress duplicating messages for different data rows (like when multiple constraint checks fail upon closing OracleLoader).

Re: OracleException behavior

Posted: Thu 08 May 2014 13:49
by Pinturiccio
We will investigate the possibility to implement behavior compatible with the one of SqlException.

Re: OracleException behavior

Posted: Wed 14 May 2014 14:25
by Pinturiccio
We have changed the behaviour: the Error property of the OracleException class is never null now and always has at least one element. Additionally, the Message property of the OracleException class now contains all distinct texts of the errors occurred when processing exceptions of the ExecuteArray method and of OracleLoader in the array binding mode. We will post here when the corresponding build of dotConnect for Oracle is available for download.

Re: OracleException behavior

Posted: Thu 15 May 2014 14:29
by Pinturiccio
New build of dotConnect for Oracle 8.3.161 is available for download!
It can be downloaded from http://www.devart.com/dotconnect/oracle/download.html (trial version) or from Registered Users' Area (for users with valid subscription only).
For more information, please refer to http://forums.devart.com/viewtopic.php?t=29592

Re: OracleException behavior

Posted: Fri 16 May 2014 18:15
by Dennis Wanke
I confirm this is now fixed