| 91 | jsError = jsContext.newError( |
| 92 | flattenedError.getMessage().toStringView(), {flattenedError.getStack().toStringView()}, exceptionTracker); |
| 93 | } |
| 94 | |
| 95 | // Carry the error code onto the JS error so consumers can branch on it instead of matching the |
| 96 | // message — kPromiseCanceledErrorCode is what lets JS tell an intentional cancellation apart |
| 97 | // from a genuine failure. Only stamped when set, to keep ordinary errors unchanged. |
| 98 | const auto errorCode = flattenedError.getErrorCode(); |
| 99 | if (errorCode != 0 && exceptionTracker) { |
| 100 | jsContext.setObjectProperty( |
| 101 | jsError.get(), std::string_view("code"), jsContext.newNumber(errorCode).get(), exceptionTracker); |
| 102 | } |
no test coverage detected