[Worklet] addModule() should reject a promise with a more specific exception |
||||||||
Issue descriptionThis is a bug for tracking a spec issue: https://github.com/w3c/css-houdini-drafts/issues/509 "The current spec defines that addModule() rejects a promise with "AbortError" DOMException in any case. This obfuscates the reason why addModule() failed and makes it hard to debug. It would be nice to reject it with a more specific exception like "NetworkError" and "SyntaxError"."
,
Jun 8 2018
,
Jun 11 2018
Looks like this is a real developer pain point (for example, [1]). Regardless of the spec change, we could print a console message. [1] https://bugs.chromium.org/p/chromium/issues/detail?id=851123#c4
,
Sep 12
Just wanted to echo that I'd love to see more specific error messages. I'm working on developing a live-coding environment for worklets and the catch-all error is not helpful..
,
Sep 25
Issue 872909 has been merged into this issue.
,
Sep 25
,
Sep 25
I'll start fixing this in parallel with the spec discussion.
,
Oct 3
I'm now trying to send V8's error object (JS_ERROR_TYPE) from a worklet thread to the main thread for resolving a promise returned by addModule() with it. This requires to serialize the error object as SerializedScriptValue. However, looks like v8's object serializer (v8::ValueSerializer::WriteObject() and v8::ValueSerializer::WriteJSReceiver()) called from SerializedScriptValue::Serialize() doesn't support it and returns a null object. We might need to change the V8 side... I'll take a closer look.
,
Oct 15
+adamk@: Hi Adam. Do you know who is the best person to ask about V8's object serializer? Specifically, I'd like to know whether a JS_ERROR_TYPE object is serializable (see my previous comment#8).
,
Oct 15
My memory is that, per spec, Error objects aren't cloneable. MDN agrees (https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Structured_clone_algorithm#Things_that_don't_work_with_structured_clone) but I can't find the precise bit of the HTML spec that knows this. Also CCing jbroman@, who wrote the value serializer.
,
Oct 15
Quoth the HTML spec[1]: "Otherwise, if value has any internal slot other than [[Prototype]] or [[Extensible]], then throw a "DataCloneError" DOMException." Quoth the ECMAScript spec[2]: "NativeError instances...have an [[ErrorData]] internal slot whose value is undefined" Thus NativeError objects (i.e., JS_ERROR_TYPE) are not structured serializable. [1]: https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal [2]: http://www.ecma-international.org/ecma-262/6.0/index.html#sec-properties-of-nativeerror-instances
,
Oct 15
err, linked NativeError, but the same applies to error: http://www.ecma-international.org/ecma-262/6.0/index.html#sec-properties-of-error-instances
,
Oct 16
adamk@, jbroman@: Thank you for the clarification! Hmm, then we need to find other ways to notify errors on worklets. I'll back to the spec discussion...
,
Nov 5
I'm still not sure what is the best way to do this. As a stopgap, I'll make a CL to print console messages as c#3.
,
Nov 13
|
||||||||
►
Sign in to add a comment |
||||||||
Comment 1 by nhiroki@chromium.org
, Nov 9 2017