|
-
Jan 26th, 2004, 10:33 AM
#1
Thread Starter
Frenzied Member
how to handle exceptions in a dll?
I have written a complicated component that is designed to handle exception logging on multiple applications. It can report errors by textfile, eventlog, db and MQ...
BUT the rather silly thing I haven't solved, is how to report errors in the component itself? What if the path to the logfile is broken, or security settings doesn't allow for eventlog monitoring? How can I bubble these exeptions and make the user adn developer aware of that something has gone wrong in the logging component itself?
kind regards
Henrik
-
Jan 26th, 2004, 01:48 PM
#2
yay gay
Maybe popup a MSGBox saying what is the problem?
\m/  \m/
-
Jan 26th, 2004, 02:03 PM
#3
Addicted Member
I am assuming that if you are writing to a file to record errors, then you or the person deploying the component with their application will have access to that log and it must be in a client/network environment.
If so, send a message back to the user in your catch block in the error module or a boolean = false to indicate it has failed. The end-programmer or you can utilize the message or boolean value in the application using the error component to display a message to the user that the erro was not able to be logged and to contact the systems administrator and/or you can try to send mail or network message from the error module to the system admin advising of the problems. To me an error that occurs in the error module is top priority so e-mail notification would be sufficient. If that fails then you can then attempt to open the users mail system, provide them with the email address in the return message as stated above. This kind of pushes the user to send an email notifying the admin of the problem(end-users are not always motivated to do so).
If I am not understanding your issue properly then please let me know. I use the same type of error logging system as you and this is how I handle that particular issue.
-
Jan 26th, 2004, 02:54 PM
#4
Well any unhandled exceptions that occur in the exception handler dll will automatically be caught by any error handling method in the calling assembly. If you want to intentionally raise an error in the calling assembly, bubble it up, then use the Throw statement to throw an exception in the calling party.
VB Code:
If Not IO.File.Exists("errorlog.txt") Then
Throw New ApplicationException("Where the hell did you put the error log?")
End If
-
Jan 26th, 2004, 03:59 PM
#5
Addicted Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|