On Friday, February 7, 2020 at 8:55:45 AM UTC-5, Boris Zbarsky wrote:
> Hello all,
> 
> We just made some changes to how exception strings from ErrorResult get 
> formatted [1].  The changes apply to both the Throw* DOMException 
> methods and ThrowTypeError/ThrowRangeError.
> 
> In the new setup, exception messages have "%s: " prepended to them, 
> where %s is replaced with one of:
> 
> * "InterfaceName.methodName", when the exception is from a method cal.
> * "InterfaceName.attrName getter", when the exception is from a getter
> * "InterfaceName.attrName setter", when the exception is from a setter
> * "InterfaceName constructor", when the exception is from a constructor.

Would you consider using something that avoids the confusion with static 
methods/properties? E.g.

- InterfaceName's methodName()
- InterfaceName's attrName getter
- InterfaceName's attrName setter

As-is it seems like it would be confusing to talk about, for example, 
Node.appendChild, which is === undefined.

I'm also curious what the output would be for actually-static methods, e.g. 
CSS.escape(), DOMPointReadOnly.fromPoint(), etc.

> 
> The idea is to give web developers a bit more context about what callee 
> failed.
> 
> I have tried to go through existing message strings and remove 
> duplication of that information where it existed.
> 
> The changes only affect exceptions thrown via the ErrorResult that 
> bindings pass to implementation methods.  In particular, Promise 
> rejections via Promise methods (as opposed to throwing on the passed-in 
> ErrorResult) do not benefit from these changes; more work will need to 
> happen there.
> 
> The changes also do not affect exceptions thrown via 
> ErrorResult::Throw(nsresult).  As a reminder, this is deprecated and 
> people should switch to the methods that provide useful error messages.
> 
> Please let me know if there are concerns around this change, suggestions 
> for further improvements, etc!
> 
> -Boris
> 
> [1] https://bugzilla.mozilla.org/show_bug.cgi?id=1613013

_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to