|
|
|
--- !ditz.rubyforge.org,2008-03-06/issue
|
|
|
|
title: clean up execution error (e.g. duk_pcall) return codes
|
|
|
|
desc: |-
|
|
|
|
Separate between "error from call" and "error setting up call"?
|
|
|
|
|
|
|
|
If this is distinguished in the return code of the call, all call sites
|
|
|
|
will have to deal with it.
|
|
|
|
|
|
|
|
One approach is to push an error on the stack even in "error setting
|
|
|
|
up call" case, but allow the caller to detect the case by inspecting
|
|
|
|
the error object. For instance, make the error object an instance of
|
|
|
|
a special error like APIError and add an API call to detect error type,
|
|
|
|
like::
|
|
|
|
|
|
|
|
if (duk_get_error_code(ctx, -1) == DUK_ERR_API_ERROR) {
|
|
|
|
...
|
|
|
|
}
|
|
|
|
|
|
|
|
What to do if the input arguments and stack are incompatible, and
|
|
|
|
return stack semantics cannot be met? For instance, if there are
|
|
|
|
not enough arguments on the value stack to match a "nargs" parameter,
|
|
|
|
we can't pop off enough arguments.
|
|
|
|
|
|
|
|
Options include:
|
|
|
|
|
|
|
|
1. Disregard these as programmer errors and call the fatal handler.
|
|
|
|
|
|
|
|
2. Throw an ordinary error. If the duk_pcall/duk_safe_call was called
|
|
|
|
from a context without error catching, the error becomes fatal
|
|
|
|
anyway. But this way, there is a chance that an outer error handler
|
|
|
|
will catch the error.
|
|
|
|
|
|
|
|
3. Return a special error code indicating that the stack is in an
|
|
|
|
inconsistent (unexpected) state. All call sites would then need
|
|
|
|
to take this into account.
|
|
|
|
type: :task
|
|
|
|
component: duk
|
|
|
|
release: v0.9
|
|
|
|
reporter: sva <sami.vaarala@iki.fi>
|
|
|
|
status: :closed
|
|
|
|
disposition: :fixed
|
|
|
|
creation_time: 2013-08-27 21:15:20.899635 Z
|
|
|
|
references: []
|
|
|
|
|
|
|
|
id: 729e2709818e510a45e64eacf68326be3e7542a2
|
|
|
|
log_events:
|
|
|
|
- - 2013-08-27 21:15:21.072680 Z
|
|
|
|
- sva <sami.vaarala@iki.fi>
|
|
|
|
- created
|
|
|
|
- ""
|
|
|
|
- - 2013-09-29 10:05:52.918270 Z
|
|
|
|
- sva <sami.vaarala@iki.fi>
|
|
|
|
- assigned to release v0.8 from v0.7
|
|
|
|
- ""
|
|
|
|
- - 2013-10-31 00:12:38.191342 Z
|
|
|
|
- sva <sami.vaarala@iki.fi>
|
|
|
|
- assigned to release v0.9 from v0.8
|
|
|
|
- ""
|
|
|
|
- - 2013-12-19 00:58:15.420084 Z
|
|
|
|
- sva <sami.vaarala@iki.fi>
|
|
|
|
- assigned to release v0.10 from v0.9
|
|
|
|
- ""
|
|
|
|
- - 2014-01-16 02:01:08.253446 Z
|
|
|
|
- sva <sami.vaarala@iki.fi>
|
|
|
|
- assigned to release v0.9 from v0.10
|
|
|
|
- ""
|
|
|
|
- - 2014-01-23 13:15:42.141657 Z
|
|
|
|
- sva <sami.vaarala@iki.fi>
|
|
|
|
- closed with disposition fixed
|
|
|
|
- ""
|