Components.Exception 编辑
Summary
Components.Exception
is a JavaScript constructor to create nsIXPCException objects. These exception objects may be thrown when implementing xpcom interfaces in JavaScript, and they can provide better diagnostics in the error console if not caught than simply throwing an nsresult
's value will.
See also nsIXPCException
.
Syntax
var exception = [ new ] Components.Exception([ message [, result [, stack [, data ] ] ] ]);
Parameters
message
- a string which can be displayed in the error console when your exception is thrown or in other developer-facing locations, defaulting to 'exception'
result
- the
nsresult
value of the exception, which defaults toComponents.results.NS_ERROR_FAILURE
stack
- an XPCOM stack to be set on the exception (defaulting to the current stack chain)
data
- any additional data you might want to store, defaulting to
null
Example
throw Components.Exception("I am throwing an Exception from a Javascript XPCOM component.");
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论