A way of explicitly reporting exceptions
Andrea Giammarchi
andrea.giammarchi at gmail.com
Mon Jun 23 14:31:32 PDT 2014
Within a list of callbacks the DOM behavior is that the error is not
actually enqueued rather "spliced" in between.
with [a, b, c] and b throwing you'll have [a, b, bthrowed, c] plus this
won't easily solve the problem: where does that error actually get
triggered ?
the DOM use global `error` handler on window object which also mean cross
realm is not an option but considering cross realm has never been a server
side issue (so far, not sure how clusters behaves in these cases) would it
make sense to have a global listener in JS too?
I don't think so, so yes, I start understanding what was the initial
problem and no, I've no idea how to solve it.
Best Regards
On Mon, Jun 23, 2014 at 2:16 PM, Allen Wirfs-Brock <allen at wirfs-brock.com>
wrote:
> It seems to me that the best way to do this in ES6 would be to run the
> call backs as individual Jobs (what until recently we were calling ES
> Tasks,
> http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tasks-and-task-queues
> ). The mechanisms are already in the ES6 spec. so that any any unhanded
> exceptions that occur in a Job are handled in the common implementation
> defined manner.
>
> What would have to be defined would be a new ES API for adding the
> invocation of a ES function as a pending job in a job queue. Maybe
> something like:
>
> Function.prototype.callAsJob = function(...args) {
> $$EnqueueJob("UserJobs", ScriptEvaluationJob, args); //handwave for
> calling ES internal abstraction operation
> }
>
> then notifyListners could just be:
>
> for (listener of listeners) {
> listener.callAsJob();
> }
>
> and all the event handlers would be enqueue before any of them actually
> ran, which I believe is closer to what we want in terms of the ES
> concurrency model.
>
> Of course, an ES level Jobs API could include other embellishments such as
> explicitly setting an unhandled exception handler for a Job, or associating
> completion of a Job with a Promise.
>
> Allen
>
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140623/0d80bc4e/attachment-0001.html>
More information about the es-discuss
mailing list