How come OracleException for all Exceptions?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for Oracle
Post Reply
kevinherring
Posts: 64
Joined: Wed 04 Jan 2006 15:32

How come OracleException for all Exceptions?

Post by kevinherring » Mon 26 Mar 2007 11:47

Hi -just a quick query/suggestion.

How come nearly all Exceptions that come back from Oracle are OracleExceptions, and not mapped to their own type? Obviously you can tell what sort of exception it is using the Code, but wouldnt it be better if you mapped each code to a specific Exception?

That way you could catch specific exceptions.

Just a thought
Thanks
Kevin

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Tue 27 Mar 2007 07:14

If you received OracleException this means that Oracle server returned an error. Its code is in the field Code. The description of each code exists in Oracle documentation.

kevinherring
Posts: 64
Joined: Wed 04 Jan 2006 15:32

Post by kevinherring » Thu 29 Mar 2007 13:09

Yes I understand how it works, but what I am suggesting is the corelab drivers catch the exception thrown by the server and then throw an exception relevant to the error. Checking the error code is soooo VB6 :-)

Using a case statement on the error code also means that my catch block loses some of its structure.

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Mon 02 Apr 2007 08:05

If I got you right you would like us to make some classes of exceptions and map server's errors to them. We do not think that checking the error code is VB6 style.

kevinherring
Posts: 64
Joined: Wed 04 Jan 2006 15:32

Post by kevinherring » Mon 02 Apr 2007 08:23

yes, that is exactly what I am saying.

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Mon 02 Apr 2007 08:33

OK, we will take note of your suggestions.

kevinherring
Posts: 64
Joined: Wed 04 Jan 2006 15:32

Post by kevinherring » Mon 02 Apr 2007 08:33

Thanks Alexey

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Mon 02 Apr 2007 08:55

You are welcome.

Post Reply