| 42 | } |
| 43 | |
| 44 | JSValueRef JSExceptionTracker::getExceptionAndClear() { |
| 45 | assertNotEmpty(); |
| 46 | |
| 47 | auto error = std::move(_error); |
| 48 | auto exception = std::move(_exception); |
| 49 | setEmpty(true); |
| 50 | |
| 51 | if (error) { |
| 52 | exception = convertValdiErrorToJSError(_jsContext, error.value(), *this); |
| 53 | if (!*this) { |
| 54 | clearError(); |
| 55 | } |
| 56 | } |
| 57 | |
| 58 | return exception; |
| 59 | } |
| 60 | |
| 61 | void JSExceptionTracker::onClearError() { |
| 62 | setEmpty(true); |