-
Notifications
You must be signed in to change notification settings - Fork 59
Description
Regarding to the existing MLContext.compute() algorithm, if input validation steps fail, it returns a rejected promise. However, in the following two steps, transferring an MLNamedArrayBufferViews steps may throw an exception because transfer an ArrayBuffer steps will throw a TypeError if DetachArrayBuffer fails.
- Let transferredInputs be the result of transferring MLNamedArrayBufferViews inputs with realm.
- Let transferredOutputs be the result of transferring MLNamedArrayBufferViews outputs with realm.
Although the exceptions thrown by step 7 and 8 should be converted to promise rejection automatically, according https://www.w3.org/2001/tag/doc/promises-guide#errors - that says
For Web IDL-based specs, this is taken care of automatically if you declare your operations to return a promise type. Any exceptions thrown by such operations, or by the Web IDL-level type conversions and overload resolution, are automatically converted into rejections.
@inexorabletash suggested
being explicit for subtle things like this is a good idea. Something like "If that throws an exception, return a promise rejected with the exception".
/cc @a-sully