| Mirage Source http://miragesource.net/forums/ |
|
| Error Handling http://miragesource.net/forums/viewtopic.php?f=210&t=3975 |
Page 1 of 1 |
| Author: | GIAKEN [ Sun Jul 13, 2008 11:51 am ] |
| Post subject: | Error Handling |
Difficulty: ? - I don't know...not too hard, though. Explanation: This error handler will give you a highly detailed error report for good error tracking. It reports: Time: Error Number (Description) at line (line) at event (Sub). What you need: You need to download CodeSMART < SERVER-SIDE > First of all, you need to go through and find all of the error handling that is already in place. So find all: Code: On Error GoTo And delete those lines. Then go to the bottom of the subs that the error handling was in and delete the error handling section (this includes the Exit Sub with the label name, which is most likely ErrHandler, then the code after that, which is the AddLog line). Now... Once you have CodeSMART installed, click "CodeSMART" in the menu. Go down to Error and Exception Handling and then click Insert Error Handlers. Now click the Schemes button, which is at the bottom left. Once in Schemes... Click "Add" in the Error Handling Schemes box (left) and type in ErrCustom as the scheme name. In the Header and Footer box, type this in the Header (top box): Code: On Error GoTo ErrHandler And in the Footer (bottom box) type this: Code: Exit {MemberType} ErrHandler: ErrorHandle "{MemberType} {MemberName}" Now at the bottom make sure that only Insert line numbers is checked and that the base number is 1 and the step number is 1. Now click Scheme-To-Element Assignments. In the Defined Assignments box go through each item changing the Error handling scheme to ErrCustom. Now X out of that and you should be back in the Insert Error Handlers window. Click the drop down box at the top and do Current Project. You should see all of the assignments saying ErrCustom after them and ErrCustom as your default scheme. Now you may click Begin! Now find: Code: ErrHandler: ErrorHandle "Sub HandleData" And change that to: Code: ErrHandler: ErrorHandle "Sub HandleData (Packet " & Parse$(0) & ")" Now it's time for the money maker...the ErrorHandle sub. At the bottom of modGeneral add: Code: Public Sub ErrorHandle(ByVal EventString As String) If Err.Number > 0 Then AddLog "Error: " & Err.Number & " (" & Err.Description & ") at line " & Erl & " in event " & EventString & ".", "errorlist.txt" End If End Sub And you should be finished! Now you have an exceptional error handling system in place for your server What to do before you code: You need to, for lack of a better word, "unlock" the server. You should get CodeSMART to remove all of the error handling code and then you can start programming. Then add all of the error handling code back in (and remove it from the class modules and the ErrorHandle sub) and you'll be good to go! Make sure you post any problems you have |
|
| Author: | James [ Mon Jul 14, 2008 7:58 am ] |
| Post subject: | Re: Error Handling |
You can do a similar thing with the client where it displays this same information to the user so they can report the error with a lot of details on your broads or mantis. |
|
| Author: | Lea [ Mon Jul 14, 2008 3:12 pm ] |
| Post subject: | Re: Error Handling |
Mirage has shitty error handling. Ideally every like in the program would be covered under some kind of check. |
|
| Author: | GIAKEN [ Mon Jul 14, 2008 7:05 pm ] |
| Post subject: | Re: Error Handling |
Well with this every sub / function has an error handler. |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|