@forge/api
8.2.1-next.18.2.1-next.1-experimental-e03cc85
out/api/errors.js~
out/api/errors.jsModified+27−2
Index: package/out/api/errors.js
===================================================================
--- package/out/api/errors.js
+++ package/out/api/errors.js
@@ -1,7 +1,7 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
-exports.ApiNotReadyError = exports.ProxyRequestError = exports.InvalidContainerServiceError = exports.InvalidRemoteError = exports.NeedsAuthenticationError = exports.InvalidWorkspaceRequestedError = exports.RequestProductNotAllowedError = exports.ProductEndpointNotAllowedError = exports.ExternalEndpointNotAllowedError = exports.NotAllowedError = exports.FetchError = exports.HttpError = exports.API_NOT_READY_ERR = exports.PROXY_ERR = exports.INVALID_CONTAINER_SERVICE_ERR = exports.INVALID_REMOTE_ERR = exports.NEEDS_AUTHENTICATION_ERR = exports.FUNCTION_FETCH_ERR = exports.REQUEST_EGRESS_ALLOWLIST_ERR = exports.FUNCTION_ERR = void 0;
+exports.ApiNotReadyError = exports.SendEmailError = exports.ProxyRequestError = exports.InvalidContainerServiceError = exports.InvalidRemoteError = exports.NeedsAuthenticationError = exports.InvalidWorkspaceRequestedError = exports.RequestProductNotAllowedError = exports.ProductEndpointNotAllowedError = exports.ExternalEndpointNotAllowedError = exports.NotAllowedError = exports.FetchError = exports.HttpError = exports.API_NOT_READY_ERR = exports.SEND_EMAIL_ERR = exports.PROXY_ERR = exports.INVALID_CONTAINER_SERVICE_ERR = exports.INVALID_REMOTE_ERR = exports.NEEDS_AUTHENTICATION_ERR = exports.FUNCTION_FETCH_ERR = exports.REQUEST_EGRESS_ALLOWLIST_ERR = exports.FUNCTION_ERR = void 0;
exports.isForgePlatformError = isForgePlatformError;
exports.isHostedCodeError = isHostedCodeError;
exports.isExpectedError = isExpectedError;
exports.FUNCTION_ERR = 'FUNCTION_ERR';
@@ -10,20 +10,28 @@
exports.NEEDS_AUTHENTICATION_ERR = 'NEEDS_AUTHENTICATION_ERR';
exports.INVALID_REMOTE_ERR = 'INVALID_REMOTE_ERR';
exports.INVALID_CONTAINER_SERVICE_ERR = 'INVALID_CONTAINER_SERVICE_ERR';
exports.PROXY_ERR = 'PROXY_ERR';
+exports.SEND_EMAIL_ERR = 'SEND_EMAIL_ERR';
exports.API_NOT_READY_ERR = 'API_NOT_READY_ERR';
function isForgePlatformError(err) {
return [
exports.REQUEST_EGRESS_ALLOWLIST_ERR,
exports.FUNCTION_FETCH_ERR,
exports.NEEDS_AUTHENTICATION_ERR,
exports.PROXY_ERR,
+ exports.SEND_EMAIL_ERR,
exports.API_NOT_READY_ERR
].includes(err.name);
}
function isHostedCodeError(err) {
- return [exports.FUNCTION_ERR, exports.REQUEST_EGRESS_ALLOWLIST_ERR, exports.FUNCTION_FETCH_ERR, exports.NEEDS_AUTHENTICATION_ERR].includes(typeof err === 'string' ? err : err.name);
+ return [
+ exports.FUNCTION_ERR,
+ exports.REQUEST_EGRESS_ALLOWLIST_ERR,
+ exports.FUNCTION_FETCH_ERR,
+ exports.NEEDS_AUTHENTICATION_ERR,
+ exports.SEND_EMAIL_ERR
+ ].includes(typeof err === 'string' ? err : err.name);
}
function isExpectedError(err) {
return err.name === exports.NEEDS_AUTHENTICATION_ERR && !!err.options?.isExpectedError;
}
@@ -118,8 +126,25 @@
this.name = exports.PROXY_ERR;
}
}
exports.ProxyRequestError = ProxyRequestError;
+class SendEmailError extends HttpError {
+ status;
+ errorCode;
+ code;
+ responseCode;
+ command;
+ constructor(status, errorCode, code, responseCode, command) {
+ super(`Failed to send email with error code: ${errorCode}`);
+ this.status = status;
+ this.errorCode = errorCode;
+ this.code = code;
+ this.responseCode = responseCode;
+ this.command = command;
+ this.name = exports.SEND_EMAIL_ERR;
+ }
+}
+exports.SendEmailError = SendEmailError;
class ApiNotReadyError extends Error {
constructor(message = 'Forge API currently not available') {
super(message);
this.name = exports.API_NOT_READY_ERR;