Browse Source

update error 'message' description to match new numeric default

pull/1/head
Sami Vaarala 11 years ago
parent
commit
c6ed54b991
  1. 12
      website/guide/errorobjects.html

12
website/guide/errorobjects.html

@ -42,6 +42,13 @@ objects is minimized to keep error objects as small as possible.</p>
Error object.</li> Error object.</li>
</ul> </ul>
<p>When error objects are created using the Duktape API from C code and the
caller does not give a format string for a <tt>message</tt>, the <tt>message</tt>
property is set to a numeric error code given in the API call. The type of
<tt>message</tt> will be number in this case; normally error messages are
strings. In minimized Duktape builds all errors generated internally by
Duktape use numeric error codes only.</p>
<p>An object is considered an "error object" if its internal prototype <p>An object is considered an "error object" if its internal prototype
chain contains the (original) <tt>Error.prototype</tt> object. Only chain contains the (original) <tt>Error.prototype</tt> object. Only
objects matching this criteria get augmented with e.g. traceback data.</p> objects matching this criteria get augmented with e.g. traceback data.</p>
@ -82,6 +89,11 @@ URIError: invalid input
global ecmascript-testcases/test-dev-traceback-example.js:3 global ecmascript-testcases/test-dev-traceback-example.js:3
</pre> </pre>
<p>In builds where tracebacks are disabled, the <tt>stack</tt> accessor
will return the same value as calling <tt>toString()</tt> on the error
would. This means you can always print <tt>e.stack</tt> and get a useful
output.</p>
<p>Attempt to write to <tt>stack</tt> is silently ignored. You can still <p>Attempt to write to <tt>stack</tt> is silently ignored. You can still
override the accessor by defining an own property of the same name explicitly override the accessor by defining an own property of the same name explicitly
with <tt>Object.defineProperty()</tt>. This behavior differs from V8 where with <tt>Object.defineProperty()</tt>. This behavior differs from V8 where

Loading…
Cancel
Save