Page 1 of 1

OracleConnection.Error + OracleException

Posted: Thu 29 Dec 2011 09:09
by tsv

I need to to do some format operations with OracleException.Message parameter when DB exception occurs.
Where (or how) can I do it?
I decided to do it in OracleConnection.Error event but it doesn't throw exception after it to catch it in outer try..catch block :(
OracleException has no public constructor :(

Soft: Mobile Edition + CF2.0

Posted: Wed 04 Jan 2012 15:54
by StanislavK
It is not a common practice to modify the message after the exception was thrown. As for the public constructor, there is none because only the dotConnect for Oracle runtime is supposed to throw OracleExceptions.

To modify the error message, you can wrap OracleException objects into exceptions of your own or standard types:

Code: Select all

catch (OracleException ex) {
  InvalidOperationException invalidOperation = 
    new InvalidOperationException(
      "The modified error message",
  throw invalidOperation;