Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 44x 132x 44x 44x 2x 42x 44x 44x 42x | const validateErrorCode = (errorCode = {}) => {
const {
id,
category,
status,
} = errorCode;
const isValid = Boolean(
id &&
category &&
status
);
if (!isValid) {
throw new TypeError('CONSUMER_ERROR_PAYLOAD_INVALID_SCHEMA');
} else {
return errorCode;
}
};
class ConsumerErrorPayload {
constructor(errorCode, stackTrace) {
this.errorCode = validateErrorCode(errorCode);
this.stackTrace = stackTrace || new Error('CONSUMER_ERROR_PAYLOAD_STACKTRACE_UNAVAILABLE');
}
}
export default ConsumerErrorPayload;
|