Hi.
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
OracleConnection.Error + OracleException
-
- Devart Team
- Posts: 1710
- Joined: Thu 03 Dec 2009 10:48
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:
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",
ex
);
throw invalidOperation;
}