Feature .js scripts stack trace only prints to gCLI and not logged. discrepancies compared to .ash

taltamir

Member
whenever there is an error in a .ash file in mafia it will print a stack trace into the gCLI and also to the session log.
however .js scripts only print the trace to the gCLI and not to the session log.
Also for some reason it is not called a stack trace even though it clearly traces the error.

For example. I recently had garbo go into an infinite loop and when i aborted it, it printed this to the gCLI
Code:
JavaScript exception: KoLmafia error: KoLmafia declares world peace. (file:/D:/games_win/Kingdom%20of%20Loathing/Mafia%20-%20taltamir_no_MrStore/scripts/garbage-collector/garbo.js#21598)
at file:/D:/games_win/Kingdom%20of%20Loathing/Mafia%20-%20taltamir_no_MrStore/scripts/garbage-collector/garbo.js:21598 (f)
at file:/D:/games_win/Kingdom%20of%20Loathing/Mafia%20-%20taltamir_no_MrStore/scripts/garbage-collector/garbo.js:22783 (freeFights)
at file:/D:/games_win/Kingdom%20of%20Loathing/Mafia%20-%20taltamir_no_MrStore/scripts/garbage-collector/garbo.js:29094
at file:/D:/games_win/Kingdom%20of%20Loathing/Mafia%20-%20taltamir_no_MrStore/scripts/garbage-collector/garbo.js:17065 (withClan)
at file:/D:/games_win/Kingdom%20of%20Loathing/Mafia%20-%20taltamir_no_MrStore/scripts/garbage-collector/garbo.js:17057 (withVIPClan)
at file:/D:/games_win/Kingdom%20of%20Loathing/Mafia%20-%20taltamir_no_MrStore/scripts/garbage-collector/garbo.js:29067
at file:/D:/games_win/Kingdom%20of%20Loathing/Mafia%20-%20taltamir_no_MrStore/scripts/garbage-collector/garbo.js:17041 (withStash)
at file:/D:/games_win/Kingdom%20of%20Loathing/Mafia%20-%20taltamir_no_MrStore/scripts/garbage-collector/garbo.js:29066 (main)
but it only put it in the gCLI and not the session log.

also, there are other discrepancies between .ash handling and .js handling for stack traces.
compare this recent stack trace
Code:
Stack trace:

  at acquireHermitItem (auto_acquire.ash:538)
  at initializeDay (autoscend.ash:917)
  at auto_begin (autoscend.ash:1918)
  at safe_preference_reset_wrapper (autoscend.ash:1960)
  at safe_preference_reset_wrapper (autoscend.ash:1967)
  at safe_preference_reset_wrapper (autoscend.ash:1967)
  at safe_preference_reset_wrapper (autoscend.ash:1967)
  at main (autoscend.ash:1995)

2. there is no "stack trace:" at the top of a .js stack trace. making it harder to search for in a log (if it was logged. which it isn't)

3. it uses the format of "file (function)" instead of "function (file)". which is an odd discrepancy. the two should be formatted the same. I am not saying either is correct here, both are valid. just they should probably use the same format.

4. it prints an entire file address instead of only the filename. for example
Code:
at file:/D:/games_win/Kingdom%20of%20Loathing/Mafia%20-%20taltamir_no_MrStore/scripts/garbage-collector/garbo.js:29066 (main)
instead of
Code:
at garbo.js:29066 (main)
 
Top