This library provides you the ability to use try-catch sections in PB. It offers just another way of error handling. You can nest sections unlimited. Be sure to NOT use TryError over procedures because PB cannot clean up the local variables! Just use it only within procedures or totally outside. Do NOT throw an error (SetTryErrorCode()) in a procedure and catch it outside! Everything within a procedure has to be handled INSIDE this procedure itself! For example this ISN'T supported! (runs but doesn't clean up and will lead to crashes): @SourceExample Enumeration #EXCPT_ANotB EndEnumeration Procedure test(a.l, b.l) ; throws #EXCPT_ANotB If a <> b SetTryErrorCode(#EXCPT_ANotB) Else MessageRequester("", "juchee!") EndIf EndProcedure If TryError() test(4, 5) Quit = #True Else Select GetTryErrorCode() Case #EXCPT_ANotB MessageRequester("Shit happens!", "Sorry, but these values are obviously not same!") Default MessageRequester("Error", "An error occured!") EndSelect EndIf @EndSourceExample |
| |