EXCEPTION LOGGER

RPG Maker VX Ace

Help you to know what happened when a script error occured

  • krosk
  • 05/04/2012 06:55 PM
  • 3160 views
When an exception (script bug) occurs in game, RMVX Ace Engine will automatically set the script editor to the location where the exception happened.

Changelog :
1.0 - initial release
1.0.1 - script in events were incorrectly processed

This script will read the backtrace of any exception occurring within the game as well as additional information, and write it back in a file. You can thus know what was the execution flow which led to the exception, have a better understanding of the bug and an easier debugging experience.

Features :
- Backtrace in a human-readable format, with line number and script lines
- Catch and log any exception triggered by a script error within a script
- Catch and log any exception triggered inside an event (map, battle, common event), as well as event location (map, event, x/y position)
- Can be used to log the backtrace of any kind of exception.

Example :
An event script in a certain map contains an error where I call an attribute to an empty object, resulting in an undefined method error of nil class.

In a classic debugging experience, I will only have:
Script 'Game_Interpreter' line 1411: NoMethodError occured.

undefined method `name' for nil:NilClass

Yes, I know from this that it is was triggered by script within an event (map or common), but it does not tell me where is this error.

With Exception Logger, you know which map, which event, at what location, and you get the culprit script. The backtrace is irrelevant in our case.
---------- Script error : event ----------

----- Error class
NoMethodError

----- Message
- ARGS : []
undefined method `name' for nil:NilClass

----- Event Script error location
MAP:1 EVENT:5 X:4,Y:5
SCRIPT:
$game_party.remove_actor(1)
p $game_party.leader.name

----- Backtrace
Script : Krosk EXCLOG | Line : 130 | Method : in `eval'
> Kernel::eval(arg)

Script : Krosk EXCLOG | Line : 130 | Method : in `eval'
> Kernel::eval(arg)

Script : Krosk EXCLOG | Line : 130 | Method : in `eval'
> Kernel::eval(arg)

Script : Game_Interpreter | Line : 1411 | Method : in `command_355'
> eval(script)

Script : Game_Interpreter | Line : 197 | Method : in `execute_command'
> send(method_name) if respond_to?(method_name)

Script : Game_Interpreter | Line : 103 | Method : in `run'
> execute_command

Script : Game_Interpreter | Line : 60 | Method : in `block in create_fiber'
> @fiber = Fiber.new { run } if @list

Posts

Pages: 1
Great script, I like it. :)
I've been using because I found it usefull when I've to report bug to scripters.
Pages: 1