inngest
Version:
Official SDK for Inngest.com. Inngest is the reliability layer for modern applications. Inngest combines durable execution, events, and queues into a zero-infra platform with built-in observability.
36 lines • 1.18 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.StepError = void 0;
const errors_js_1 = require("../helpers/errors.js");
const types_js_1 = require("../types.js");
/**
* An error that represents a step exhausting all retries and failing. This is
* thrown by an Inngest step if it fails.
*
* It's synonymous with an `Error`, with the addition of the `stepId` that
* failed.
*
* @public
*/
class StepError extends Error {
constructor(
/**
* The ID of the step that failed.
*/
stepId, err) {
var _a;
const parsedErr = types_js_1.jsonErrorSchema.parse(err);
super(parsedErr.message);
this.stepId = stepId;
this.name = parsedErr.name;
this.stepId = stepId;
// Don't show the internal stack trace if we don't have one.
this.stack = (_a = parsedErr.stack) !== null && _a !== void 0 ? _a : undefined;
// Try setting the cause if we have one
this.cause = parsedErr.cause
? (0, errors_js_1.deserializeError)(parsedErr.cause)
: undefined;
}
}
exports.StepError = StepError;
//# sourceMappingURL=StepError.js.map