View/Edit #12:handle_uncaught_error

Switch to edit mode.

Name(s): handle_uncaught_error
1:  "Record the TB for later viewing by @last-tb"
2:  "Improved to allow viewing of multiple Tb's by Quadir (#9780)"
3:  "Improved to display a more appropriate traceback for non-technically minded people by Absolute(#7153), original concept done by Quadir (#9780)"
4:  caller_perms():controls(this) || raise(E_PERM)
5:  if (typeof(this.last_tb) != $LIST || length(this.last_tb) != 2 || typeof(this.last_tb[1]) != $INT || typeof(this.last_tb[2]) != $LIST)
6:    this.last_tb = {3, {}}
7:  endif
8:  this.last_tb[2] = {@this.last_tb[2], {args[$], time()}}
9:  if (length(this.last_tb[2]) > this.last_tb[1])
10:   "Clear away old tb's"
11:   this.last_tb[2] = this.last_tb[2][$ - this.last_tb[1] + 1..$]
12: endif
13: if (!this:display_option("show_tbs"))
14:   {code, msg, value, traceback, formatted} = args
15:   "... Display the proper code for the error generated, not the message associated it with the code ... "
16:   line = toliteral(code)
17:   for x in (traceback)
18:     "  ... Append every trace of the error back to the source ..."
19:     line = tostr(x[4], ":", x[2], ", line ", x[6], " -> ") + line
20:   endfor
21:   player:notify(tostr("Oops!  An error of '", msg ? msg | code, "' has occured while executing '", traceback[$][2], "'."))
22:   player:notify(tostr("Please inform ", $su:nn(traceback[1][3]), " of the following:  ", line))
23:   return 1
24: else
25:   " ... Seems they want the full error ... "
26:   pass(@args)
27: endif
28: "Last modified by Dax (#789) on Mon Aug  7 21:50:36 2006 MDT."

Verb arguments: this none this
Verb perms: Readable eXecutable NOT-Debug
Verb owned by: Dax (#789)

You are not logged in.

[home | help | who | search | setup | code]