Our app calls a web service, which in turns calls a DLL, which does something to the DB.
If there is an error in the DB code, how would you pass the exception back to the UI?
Woka
Printable View
Our app calls a web service, which in turns calls a DLL, which does something to the DB.
If there is an error in the DB code, how would you pass the exception back to the UI?
Woka
Is the Web Service yours?
If it is create a return object that can contain all the information you want the service to pass back. This way you can give your return object a bool OK property to check and if it is false have an ArrayList of strings that contains any applicable error messages.
I let the exception bubble up to the thin client. For example, when the db layer throws an exception, it goes to the web service, the web service passes it to the asp.net page, where it's handled.
how does it pass it to the asp.net page?
Hmmm. It does get raised across the web service...:confused:
I have been lied to!
Cheers for your help.
Woka
It comes to the page as a SoapException. I look at its base exception
Cheers froggy.
How can you see the base exception?
Ex.Base doesn't exist? :(
Woof
You can use the GetBaseException function, which will return an exception.
We had a web service with the folloiwng style of functions:
I changed this to:VB Code:
Public Function AllUsersForPip(ByVal PipKey As Integer, ByRef ErrorEnum As enmCustomErrors) As DataSet Try ErrorEnum = enmCustomErrors.Success Return m_ApplesWS.AllUsersForPip(PipKey) Catch ErrorEnum = enmCustomErrors.SessionTimeout End Try End Function
Much simpler...if the session is timed out then a custom exception is raised from within m_ApplesWS.VB Code:
Public Function AllUsersForPip(ByVal PipKey As Integer) As DataSet Return m_ApplesWS.AllUsersForPip(PipKey) End Function
We had over 50 functions that all did this....POINTLESS!
All err info was lost as regardless of the error no info got passed back to the UI from the web service :(
I have now removed all these daft error enums from functions, and other developers here are not happy coz they wrote it a few weeks ago. Oooops.
Well not my fault it was wrong :D
Woka