[CODE HELP] HOW TO THROW ERROR EXCEPTIONS IN RMXP SCRIPTS?
Posts
Pages:
1
Hi guys... I need to know how to throw an exception in the RMXP scripts.
If this was standard ruby, I know how to print messages to the terminal window.
This is what I have ATM:
I'm using RMXP's MAIN() exception as an example, but I'm not sure if what I have is correct. Since the except thrown will be sent to a windows exception handle window (behind the scenes)... not sure what the proper code should be.
Thanks.
If this was standard ruby, I know how to print messages to the terminal window.
This is what I have ATM:
if something
# ...
else
rescue SystemExit
print 'Error in XXX script file' <<
'in class XXX' <<
'within method privDetermineUILocation'
end
I'm using RMXP's MAIN() exception as an example, but I'm not sure if what I have is correct. Since the except thrown will be sent to a windows exception handle window (behind the scenes)... not sure what the proper code should be.
Thanks.
iirc it's raise Exception.new("Exception Message here"). Replace Exception with the class of exception you want to throw. If an exception will kill your game then it's best just to set up the exception handler in the Main script and use the message part of the exception to say where the exception occurred. Also check out Krosk's Ace exception logger for some ideas (or even adapt the script to XP) on what to add to your exception handling.
Pages:
1














