Because the constraint names are unique (BOB.SITE_NAME_I), you can use them
as keys into a resource file.
(BOB.SITE_NAME_I = "You must use a unique site name.")
When you catch the exception, you can return the error message if the
constraint is found in the resource, and re-throw the exception if it isn't.

-----Original Message-----
From: Unmoderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Bill Bassler
Sent: Monday, July 12, 2004 10:12 AM
To: [EMAIL PROTECTED]
Subject: [ADVANCED-DOTNET] Best app design option to map returned Exceptions
to user-friendly messages

What is the best application design options to detect and map errors to
user-friendly displays. I have a middle tier component that can generate
the following error and return a serialized exception to the client

For example, the error below:

Esylvan.Modules.AcademicGroupManagement.Business.SiteCreationException:
General exception occurred during Site creation. ORA-00001: unique
constraint (BOB.SITE_NAME_I) violated
ORA-06512: at "BOB.ACADEMIC_GROUP_MANAGEMENT", line 144
ORA-06512: at line 1

Within the client ... what's the best way to detect when this error is
generated from the component and transform the error into a user-friendly
display message like: "You must use a unique site name."

I appears there's not a lot of options other than a very hard-coded
solution.

Can resx files be used in some way? I believe the old IBuySpy app utilized
resource files for something like this.

===================================
This list is hosted by DevelopMentorR  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentor�  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to