本文整理汇总了C++中Exception::value方法的典型用法代码示例。如果您正苦于以下问题:C++ Exception::value方法的具体用法?C++ Exception::value怎么用?C++ Exception::value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Exception
的用法示例。
在下文中一共展示了Exception::value方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getUserMedia
JSValue JSMediaDevices::getUserMedia(ExecState* exec)
{
JSPromiseDeferred* promiseDeferred = JSPromiseDeferred::create(exec, globalObject());
DeferredWrapper wrapper(exec, globalObject(), promiseDeferred);
Dictionary options(exec, exec->argument(0));
if (exec->hadException()) {
Exception* exception = exec->exception();
exec->clearException();
wrapper.reject(exception->value());
return promiseDeferred->promise();
}
if (!options.isObject()) {
JSValue error = createTypeError(exec, "First argument of getUserMedia must be a valid Dictionary");
wrapper.reject(error);
return promiseDeferred->promise();
}
auto resolveCallback = [wrapper](MediaStream& stream) mutable {
wrapper.resolve(&stream);
};
auto rejectCallback = [wrapper](NavigatorUserMediaError& error) mutable {
wrapper.reject(&error);
};
ExceptionCode ec = 0;
impl().getUserMedia(options, WTF::move(resolveCallback), WTF::move(rejectCallback), ec);
if (ec)
wrapper.reject(ec);
return promiseDeferred->promise();
}
示例2: handleExceptionIfNeeded
static ExceptionStatus handleExceptionIfNeeded(ExecState* exec, JSValueRef* returnedExceptionRef)
{
if (exec->hadException()) {
Exception* exception = exec->exception();
if (returnedExceptionRef)
*returnedExceptionRef = toRef(exec, exception->value());
exec->clearException();
#if ENABLE(REMOTE_INSPECTOR)
exec->vmEntryGlobalObject()->inspectorController().reportAPIException(exec, exception);
#endif
return ExceptionStatus::DidThrow;
}
return ExceptionStatus::DidNotThrow;
}