freestyle
Version:
Learn more at [docs.freestyle.sh](https://docs.freestyle.sh)
1,666 lines (1,665 loc) • 303 kB
JavaScript
import path__default from 'path';
function errorFromJSON(body, traceId) {
const ErrorClass = FREESTYLE_ERROR_CODE_MAP[body.code];
if (ErrorClass) {
return new ErrorClass(body, traceId);
} else {
return new Error(`Unknown error code: ${body.code} - ${body.description}${traceId ? `
TraceId: ${traceId}` : ""}`);
}
}
class GitErrorError extends Error {
constructor(body, traceId) {
super(
`GIT_ERROR: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "GitErrorError";
}
static code = "GIT_ERROR";
static statusCode = 500;
static description = `{message}`;
}
class BadParseError extends Error {
constructor(body, traceId) {
super(
`BAD_PARSE: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "BadParseError";
}
static code = "BAD_PARSE";
static statusCode = 400;
static description = `error parsing event object: {0}`;
}
class BadTimestampError extends Error {
constructor(body, traceId) {
super(
`BAD_TIMESTAMP: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "BadTimestampError";
}
static code = "BAD_TIMESTAMP";
static statusCode = 403;
static description = `error comparing timestamps - over tolerance`;
}
class BadSignatureError extends Error {
constructor(body, traceId) {
super(
`BAD_SIGNATURE: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "BadSignatureError";
}
static code = "BAD_SIGNATURE";
static statusCode = 403;
static description = `error comparing signatures`;
}
class BadHeaderError extends Error {
constructor(body, traceId) {
super(
`BAD_HEADER: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "BadHeaderError";
}
static code = "BAD_HEADER";
static statusCode = 400;
static description = `error parsing timestamp: {0}`;
}
class BadKeyError extends Error {
constructor(body, traceId) {
super(
`BAD_KEY: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "BadKeyError";
}
static code = "BAD_KEY";
static statusCode = 400;
static description = `invalid key length`;
}
class VmOperationDeniedDuringTransactionError extends Error {
constructor(body, traceId) {
super(
`VM_OPERATION_DENIED_DURING_TRANSACTION: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "VmOperationDeniedDuringTransactionError";
}
static code = "VM_OPERATION_DENIED_DURING_TRANSACTION";
static statusCode = 409;
static description = `VM operation denied during active transaction for VM {vm_id} in transaction {transaction_id}`;
}
class VmTransactionIdMismatchError extends Error {
constructor(body, traceId) {
super(
`VM_TRANSACTION_ID_MISMATCH: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "VmTransactionIdMismatchError";
}
static code = "VM_TRANSACTION_ID_MISMATCH";
static statusCode = 400;
static description = `Transaction ID {provided_transaction_id} does not match the current VM transaction {expected_transaction_id} for VM {vm_id}`;
}
class VmNotInTransactionError extends Error {
constructor(body, traceId) {
super(
`VM_NOT_IN_TRANSACTION: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "VmNotInTransactionError";
}
static code = "VM_NOT_IN_TRANSACTION";
static statusCode = 404;
static description = `VM not in a transaction: {vm_id}`;
}
class PartitionNotFoundError extends Error {
constructor(body, traceId) {
super(
`PARTITION_NOT_FOUND: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "PartitionNotFoundError";
}
static code = "PARTITION_NOT_FOUND";
static statusCode = 404;
static description = `Partition not found: {partition_id}`;
}
class UserNotFoundError extends Error {
constructor(body, traceId) {
super(
`USER_NOT_FOUND: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "UserNotFoundError";
}
static code = "USER_NOT_FOUND";
static statusCode = 404;
static description = `User not found: {user_name}`;
}
class UserAlreadyExistsError extends Error {
constructor(body, traceId) {
super(
`USER_ALREADY_EXISTS: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "UserAlreadyExistsError";
}
static code = "USER_ALREADY_EXISTS";
static statusCode = 409;
static description = `Conflict: User '{user_name}' already exists`;
}
class ValidationErrorError extends Error {
constructor(body, traceId) {
super(
`VALIDATION_ERROR: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "ValidationErrorError";
}
static code = "VALIDATION_ERROR";
static statusCode = 400;
static description = `Validation error: {message}`;
}
class GroupNotFoundError extends Error {
constructor(body, traceId) {
super(
`GROUP_NOT_FOUND: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "GroupNotFoundError";
}
static code = "GROUP_NOT_FOUND";
static statusCode = 404;
static description = `Group not found: {group_name}`;
}
class GroupAlreadyExistsError extends Error {
constructor(body, traceId) {
super(
`GROUP_ALREADY_EXISTS: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "GroupAlreadyExistsError";
}
static code = "GROUP_ALREADY_EXISTS";
static statusCode = 409;
static description = `Conflict: Group '{group_name}' already exists`;
}
class DuplicateUserNameError extends Error {
constructor(body, traceId) {
super(
`DUPLICATE_USER_NAME: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "DuplicateUserNameError";
}
static code = "DUPLICATE_USER_NAME";
static statusCode = 400;
static description = `Duplicate user name '{name}' found`;
}
class UserGroupEmptyError extends Error {
constructor(body, traceId) {
super(
`USER_GROUP_EMPTY: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "UserGroupEmptyError";
}
static code = "USER_GROUP_EMPTY";
static statusCode = 400;
static description = `User '{user}' has empty string in groups`;
}
class UserSystemFlagMismatchError extends Error {
constructor(body, traceId) {
super(
`USER_SYSTEM_FLAG_MISMATCH: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "UserSystemFlagMismatchError";
}
static code = "USER_SYSTEM_FLAG_MISMATCH";
static statusCode = 400;
static description = `User '{user}' has system=true but UID {uid} is > 999 (system range)`;
}
class UserUidOutOfRangeError extends Error {
constructor(body, traceId) {
super(
`USER_UID_OUT_OF_RANGE: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "UserUidOutOfRangeError";
}
static code = "USER_UID_OUT_OF_RANGE";
static statusCode = 400;
static description = `User '{user}' has invalid UID {uid} (must be 0-65535)`;
}
class UserHomeInvalidError extends Error {
constructor(body, traceId) {
super(
`USER_HOME_INVALID: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "UserHomeInvalidError";
}
static code = "USER_HOME_INVALID";
static statusCode = 400;
static description = `User '{user}' has invalid home path '{home}' (must be absolute path starting with /)`;
}
class UserShellInvalidError extends Error {
constructor(body, traceId) {
super(
`USER_SHELL_INVALID: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "UserShellInvalidError";
}
static code = "USER_SHELL_INVALID";
static statusCode = 400;
static description = `User '{user}' has invalid shell path '{shell}' (must be absolute path starting with /)`;
}
class DuplicateGroupNameError extends Error {
constructor(body, traceId) {
super(
`DUPLICATE_GROUP_NAME: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "DuplicateGroupNameError";
}
static code = "DUPLICATE_GROUP_NAME";
static statusCode = 400;
static description = `Duplicate group name '{name}' found`;
}
class GroupNameReservedError extends Error {
constructor(body, traceId) {
super(
`GROUP_NAME_RESERVED: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "GroupNameReservedError";
}
static code = "GROUP_NAME_RESERVED";
static statusCode = 400;
static description = `Group name '{name}' is reserved and cannot be used`;
}
class GroupNameInvalidCharsError extends Error {
constructor(body, traceId) {
super(
`GROUP_NAME_INVALID_CHARS: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "GroupNameInvalidCharsError";
}
static code = "GROUP_NAME_INVALID_CHARS";
static statusCode = 400;
static description = `Group name '{name}' contains invalid characters (must match [a-z_][a-z0-9_-]*)`;
}
class GroupNameTooLongError extends Error {
constructor(body, traceId) {
super(
`GROUP_NAME_TOO_LONG: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "GroupNameTooLongError";
}
static code = "GROUP_NAME_TOO_LONG";
static statusCode = 400;
static description = `Group name '{name}' is too long (max {max_length} characters)`;
}
class GroupNameEmptyError extends Error {
constructor(body, traceId) {
super(
`GROUP_NAME_EMPTY: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "GroupNameEmptyError";
}
static code = "GROUP_NAME_EMPTY";
static statusCode = 400;
static description = `Group name cannot be empty`;
}
class NoDefaultSnapshotAvailableError extends Error {
constructor(body, traceId) {
super(
`NO_DEFAULT_SNAPSHOT_AVAILABLE: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "NoDefaultSnapshotAvailableError";
}
static code = "NO_DEFAULT_SNAPSHOT_AVAILABLE";
static statusCode = 404;
static description = `No default snapshot available for account {account_id}`;
}
class DockerSnapshotFailedError extends Error {
constructor(body, traceId) {
super(
`DOCKER_SNAPSHOT_FAILED: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "DockerSnapshotFailedError";
}
static code = "DOCKER_SNAPSHOT_FAILED";
static statusCode = 500;
static description = `Failed to create snapshot from Docker image {docker_image} for account {account_id}: {details}`;
}
class SetDefaultSnapshotFailedError extends Error {
constructor(body, traceId) {
super(
`SET_DEFAULT_SNAPSHOT_FAILED: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "SetDefaultSnapshotFailedError";
}
static code = "SET_DEFAULT_SNAPSHOT_FAILED";
static statusCode = 500;
static description = `Failed to update default snapshot in database for account {account_id}, snapshot {snapshot_id}: {details}`;
}
class SnapshotLayerCreationFailedError extends Error {
constructor(body, traceId) {
super(
`SNAPSHOT_LAYER_CREATION_FAILED: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "SnapshotLayerCreationFailedError";
}
static code = "SNAPSHOT_LAYER_CREATION_FAILED";
static statusCode = 500;
static description = `Failed to create snapshot layer for account {account_id} from {source_snapshot_dir}: {details}`;
}
class SnapshotDirNotFoundError extends Error {
constructor(body, traceId) {
super(
`SNAPSHOT_DIR_NOT_FOUND: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "SnapshotDirNotFoundError";
}
static code = "SNAPSHOT_DIR_NOT_FOUND";
static statusCode = 500;
static description = `Snapshot directory not found at {snapshot_dir} for account {account_id}, snapshot {snapshot_id}`;
}
class SubvolumeCreationFailedError extends Error {
constructor(body, traceId) {
super(
`SUBVOLUME_CREATION_FAILED: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "SubvolumeCreationFailedError";
}
static code = "SUBVOLUME_CREATION_FAILED";
static statusCode = 500;
static description = `Failed to create account subvolume for account {account_id}: {details}`;
}
class GetDefaultSnapshotFailedError extends Error {
constructor(body, traceId) {
super(
`GET_DEFAULT_SNAPSHOT_FAILED: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "GetDefaultSnapshotFailedError";
}
static code = "GET_DEFAULT_SNAPSHOT_FAILED";
static statusCode = 500;
static description = `Failed to query account default snapshot for account {account_id}: {details}`;
}
class VmNotFoundInFsError extends Error {
constructor(body, traceId) {
super(
`VM_NOT_FOUND_IN_FS: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "VmNotFoundInFsError";
}
static code = "VM_NOT_FOUND_IN_FS";
static statusCode = 406;
static description = `Vm Not found in filesystem`;
}
class DatabaseErrorError extends Error {
constructor(body, traceId) {
super(
`DATABASE_ERROR: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "DatabaseErrorError";
}
static code = "DATABASE_ERROR";
static statusCode = 500;
static description = `Database error occurred while constructing VmRecord, details: {details}`;
}
class InvalidVmIdError extends Error {
constructor(body, traceId) {
super(
`INVALID_VM_ID: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "InvalidVmIdError";
}
static code = "INVALID_VM_ID";
static statusCode = 400;
static description = `Invalid VM ID: {vm_id}, details: {details}`;
}
class VmDeletedError extends Error {
constructor(body, traceId) {
super(
`VM_DELETED: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "VmDeletedError";
}
static code = "VM_DELETED";
static statusCode = 500;
static description = `Vm {vm_id} is marked as deleted but still exists in the database`;
}
class VmNotRunningError extends Error {
constructor(body, traceId) {
super(
`VM_NOT_RUNNING: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "VmNotRunningError";
}
static code = "VM_NOT_RUNNING";
static statusCode = 400;
static description = `Stopped VM not running`;
}
class ActiveTransactionErrorError extends Error {
constructor(body, traceId) {
super(
`ACTIVE_TRANSACTION_ERROR: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "ActiveTransactionErrorError";
}
static code = "ACTIVE_TRANSACTION_ERROR";
static statusCode = 500;
static description = `Active transaction error: {details}`;
}
class SwapVmTapError extends Error {
constructor(body, traceId) {
super(
`SWAP_VM_TAP: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "SwapVmTapError";
}
static code = "SWAP_VM_TAP";
static statusCode = 500;
static description = `Failed to swap tap device: {details}`;
}
class PreassignedVmIdCountMismatchError extends Error {
constructor(body, traceId) {
super(
`PREASSIGNED_VM_ID_COUNT_MISMATCH: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "PreassignedVmIdCountMismatchError";
}
static code = "PREASSIGNED_VM_ID_COUNT_MISMATCH";
static statusCode = 400;
static description = `Pre-provisioned vm_ids length ({provided}) must match fork count ({count})`;
}
class InternalErrorError extends Error {
constructor(body, traceId) {
super(
`INTERNAL_ERROR: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "InternalErrorError";
}
static code = "INTERNAL_ERROR";
static statusCode = 500;
static description = `Fork failed: {message}`;
}
class RootfsCopyErrorError extends Error {
constructor(body, traceId) {
super(
`ROOTFS_COPY_ERROR: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "RootfsCopyErrorError";
}
static code = "ROOTFS_COPY_ERROR";
static statusCode = 500;
static description = `Failed to copy rootfs from {from} to {to}: {details}`;
}
class FileNotFoundError extends Error {
constructor(body, traceId) {
super(
`FILE_NOT_FOUND: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "FileNotFoundError";
}
static code = "FILE_NOT_FOUND";
static statusCode = 404;
static description = `File not found: {path}`;
}
class FilesBadRequestError extends Error {
constructor(body, traceId) {
super(
`FILES_BAD_REQUEST: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "FilesBadRequestError";
}
static code = "FILES_BAD_REQUEST";
static statusCode = 400;
static description = `Bad request: {message}`;
}
class VmNotFoundError extends Error {
constructor(body, traceId) {
super(
`VM_NOT_FOUND: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "VmNotFoundError";
}
static code = "VM_NOT_FOUND";
static statusCode = 404;
static description = `VM not found: {vm_id}`;
}
class InternalForkVmNotFoundError extends Error {
constructor(body, traceId) {
super(
`INTERNAL_FORK_VM_NOT_FOUND: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "InternalForkVmNotFoundError";
}
static code = "INTERNAL_FORK_VM_NOT_FOUND";
static statusCode = 404;
static description = `The VM you're trying to fork from was not found: {fork_vm_id}`;
}
class BadRequestError extends Error {
constructor(body, traceId) {
super(
`BAD_REQUEST: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "BadRequestError";
}
static code = "BAD_REQUEST";
static statusCode = 400;
static description = `Bad request: {message}`;
}
class InternalVmNotFoundError extends Error {
constructor(body, traceId) {
super(
`INTERNAL_VM_NOT_FOUND: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "InternalVmNotFoundError";
}
static code = "INTERNAL_VM_NOT_FOUND";
static statusCode = 404;
static description = `VM not found: {vm_id}`;
}
class SnapshotIsAccountDefaultError extends Error {
constructor(body, traceId) {
super(
`SNAPSHOT_IS_ACCOUNT_DEFAULT: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "SnapshotIsAccountDefaultError";
}
static code = "SNAPSHOT_IS_ACCOUNT_DEFAULT";
static statusCode = 409;
static description = `Snapshot is the account default and cannot be deleted: {snapshot_id}`;
}
class SnapshotAlreadyDeletedError extends Error {
constructor(body, traceId) {
super(
`SNAPSHOT_ALREADY_DELETED: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "SnapshotAlreadyDeletedError";
}
static code = "SNAPSHOT_ALREADY_DELETED";
static statusCode = 409;
static description = `Snapshot already deleted: {snapshot_id}`;
}
class SnapshotNotFoundError extends Error {
constructor(body, traceId) {
super(
`SNAPSHOT_NOT_FOUND: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "SnapshotNotFoundError";
}
static code = "SNAPSHOT_NOT_FOUND";
static statusCode = 404;
static description = `Snapshot not found: {snapshot_id}`;
}
class SnapshotSetupFailedError extends Error {
constructor(body, traceId) {
super(
`SNAPSHOT_SETUP_FAILED: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "SnapshotSetupFailedError";
}
static code = "SNAPSHOT_SETUP_FAILED";
static statusCode = 500;
static description = `Snapshot setup failed: {failed_reason}`;
}
class SnapshotVmBadRequestError extends Error {
constructor(body, traceId) {
super(
`SNAPSHOT_VM_BAD_REQUEST: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "SnapshotVmBadRequestError";
}
static code = "SNAPSHOT_VM_BAD_REQUEST";
static statusCode = 400;
static description = `Bad request: {message}`;
}
class StartingHandleInstanceIdMismatchError extends Error {
constructor(body, traceId) {
super(
`STARTING_HANDLE_INSTANCE_ID_MISMATCH: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "StartingHandleInstanceIdMismatchError";
}
static code = "STARTING_HANDLE_INSTANCE_ID_MISMATCH";
static statusCode = 409;
static description = `Starting handle for VM {vm_id} is held by instance {actual_instance_id}, not {provided_instance_id}`;
}
class SuspendFailedAndStopFailedError extends Error {
constructor(body, traceId) {
super(
`SUSPEND_FAILED_AND_STOP_FAILED: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "SuspendFailedAndStopFailedError";
}
static code = "SUSPEND_FAILED_AND_STOP_FAILED";
static statusCode = 500;
static description = `Failed to gracefully suspend or stop VM`;
}
class SuspendFailedAndStoppedError extends Error {
constructor(body, traceId) {
super(
`SUSPEND_FAILED_AND_STOPPED: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "SuspendFailedAndStoppedError";
}
static code = "SUSPEND_FAILED_AND_STOPPED";
static statusCode = 500;
static description = `Failed to gracefully suspend, stopped VM`;
}
class ResizeVmMemNotPowerOfTwoError extends Error {
constructor(body, traceId) {
super(
`RESIZE_VM_MEM_NOT_POWER_OF_TWO: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "ResizeVmMemNotPowerOfTwoError";
}
static code = "RESIZE_VM_MEM_NOT_POWER_OF_TWO";
static statusCode = 400;
static description = `memSizeMb must be a power of two in MiB (got {got} MiB)`;
}
class ResizeVmVcpuNotPowerOfTwoError extends Error {
constructor(body, traceId) {
super(
`RESIZE_VM_VCPU_NOT_POWER_OF_TWO: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "ResizeVmVcpuNotPowerOfTwoError";
}
static code = "RESIZE_VM_VCPU_NOT_POWER_OF_TWO";
static statusCode = 400;
static description = `vcpuCount must be a power of two (got {got})`;
}
class ResizeVmMemOutOfRangeError extends Error {
constructor(body, traceId) {
super(
`RESIZE_VM_MEM_OUT_OF_RANGE: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "ResizeVmMemOutOfRangeError";
}
static code = "RESIZE_VM_MEM_OUT_OF_RANGE";
static statusCode = 400;
static description = `memSizeMb out of range (got {got}MiB, allowed {min}..={max} MiB)`;
}
class ResizeVmVcpuOutOfRangeError extends Error {
constructor(body, traceId) {
super(
`RESIZE_VM_VCPU_OUT_OF_RANGE: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "ResizeVmVcpuOutOfRangeError";
}
static code = "RESIZE_VM_VCPU_OUT_OF_RANGE";
static statusCode = 400;
static description = `vcpuCount out of range (got {got}, allowed 1..={max})`;
}
class ResizeVmRootfsShrinkNotSupportedError extends Error {
constructor(body, traceId) {
super(
`RESIZE_VM_ROOTFS_SHRINK_NOT_SUPPORTED: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "ResizeVmRootfsShrinkNotSupportedError";
}
static code = "RESIZE_VM_ROOTFS_SHRINK_NOT_SUPPORTED";
static statusCode = 400;
static description = `Rootfs shrink is not supported (current={current_mb}MiB, requested={requested_mb}MiB)`;
}
class ResizeVmEmptyRequestError extends Error {
constructor(body, traceId) {
super(
`RESIZE_VM_EMPTY_REQUEST: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "ResizeVmEmptyRequestError";
}
static code = "RESIZE_VM_EMPTY_REQUEST";
static statusCode = 400;
static description = `Resize request must specify at least one of vcpuCount, memSizeMb, or rootfsSizeMb`;
}
class ExecTimedOutError extends Error {
constructor(body, traceId) {
super(
`EXEC_TIMED_OUT: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "ExecTimedOutError";
}
static code = "EXEC_TIMED_OUT";
static statusCode = 408;
static description = `Command timed out after {timeout_ms}ms`;
}
class ConflictingSpecSourcesErrorError extends Error {
constructor(body, traceId) {
super(
`CONFLICTING_SPEC_SOURCES_ERROR: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "ConflictingSpecSourcesErrorError";
}
static code = "CONFLICTING_SPEC_SOURCES_ERROR";
static statusCode = 400;
static description = `Spec layer at depth {depth} has conflicting base sources \`{field_a}\` and \`{field_b}\`; each layer may set at most one of \`snapshot\`, \`snapshotId\`, \`baseImage\``;
}
class NonLeafLayerFieldErrorError extends Error {
constructor(body, traceId) {
super(
`NON_LEAF_LAYER_FIELD_ERROR: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "NonLeafLayerFieldErrorError";
}
static code = "NON_LEAF_LAYER_FIELD_ERROR";
static statusCode = 400;
static description = `Field \`{field}\` may only be set on the innermost spec layer; found on a non-leaf layer at depth {depth} (0 = outermost)`;
}
class InvalidGitRepoSpecErrorError extends Error {
constructor(body, traceId) {
super(
`INVALID_GIT_REPO_SPEC_ERROR: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "InvalidGitRepoSpecErrorError";
}
static code = "INVALID_GIT_REPO_SPEC_ERROR";
static statusCode = 400;
static description = `Cannot specify both root-level \`gitRepos\` and \`git.repos\`. Prefer \`git.repos\`.`;
}
class ForkVmNotFoundError extends Error {
constructor(body, traceId) {
super(
`FORK_VM_NOT_FOUND: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "ForkVmNotFoundError";
}
static code = "FORK_VM_NOT_FOUND";
static statusCode = 404;
static description = `Fork VM not found: {fork_vm_id}`;
}
class CreateSnapshotBadRequestError extends Error {
constructor(body, traceId) {
super(
`CREATE_SNAPSHOT_BAD_REQUEST: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "CreateSnapshotBadRequestError";
}
static code = "CREATE_SNAPSHOT_BAD_REQUEST";
static statusCode = 400;
static description = `Bad request: {message}`;
}
class UnsupportedOsError extends Error {
constructor(body, traceId) {
super(
`UNSUPPORTED_OS: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "UnsupportedOsError";
}
static code = "UNSUPPORTED_OS";
static statusCode = 400;
static description = `Unsupported base image OS: {os}`;
}
class BuildFailedError extends Error {
constructor(body, traceId) {
super(
`BUILD_FAILED: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "BuildFailedError";
}
static code = "BUILD_FAILED";
static statusCode = 400;
static description = `Dockerfile build failed (exit {exit_code})`;
}
class ResumedVmNonResponsiveError extends Error {
constructor(body, traceId) {
super(
`RESUMED_VM_NON_RESPONSIVE: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "ResumedVmNonResponsiveError";
}
static code = "RESUMED_VM_NON_RESPONSIVE";
static statusCode = 500;
static description = `Resumed VM {vm_id} is not responsive after {timeout_seconds}s`;
}
class SnapshotLoadTimeoutError extends Error {
constructor(body, traceId) {
super(
`SNAPSHOT_LOAD_TIMEOUT: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "SnapshotLoadTimeoutError";
}
static code = "SNAPSHOT_LOAD_TIMEOUT";
static statusCode = 500;
static description = `Snapshot load timed out after {elapsed_seconds}s for instance {vm_instance_id}, logs: {log_path}`;
}
class UffdTimeoutErrorError extends Error {
constructor(body, traceId) {
super(
`UFFD_TIMEOUT_ERROR: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "UffdTimeoutErrorError";
}
static code = "UFFD_TIMEOUT_ERROR";
static statusCode = 500;
static description = `UFFD socket timeout: {report_socket_path}, logs: {log_path}`;
}
class KernelPanicError extends Error {
constructor(body, traceId) {
super(
`KERNEL_PANIC: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "KernelPanicError";
}
static code = "KERNEL_PANIC";
static statusCode = 500;
static description = `VM kernel panic detected`;
}
class ReqwestError extends Error {
constructor(body, traceId) {
super(
`REQWEST: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "ReqwestError";
}
static code = "REQWEST";
static statusCode = 500;
static description = `Reqwest error: {details}`;
}
class FirecrackerPidNotFoundError extends Error {
constructor(body, traceId) {
super(
`FIRECRACKER_PID_NOT_FOUND: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "FirecrackerPidNotFoundError";
}
static code = "FIRECRACKER_PID_NOT_FOUND";
static statusCode = 500;
static description = `Firecracker PID not found`;
}
class FirecrackerApiSocketNotFoundError extends Error {
constructor(body, traceId) {
super(
`FIRECRACKER_API_SOCKET_NOT_FOUND: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "FirecrackerApiSocketNotFoundError";
}
static code = "FIRECRACKER_API_SOCKET_NOT_FOUND";
static statusCode = 500;
static description = `Firecracker API socket not found`;
}
class InvalidSnapshotIdError extends Error {
constructor(body, traceId) {
super(
`INVALID_SNAPSHOT_ID: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "InvalidSnapshotIdError";
}
static code = "INVALID_SNAPSHOT_ID";
static statusCode = 400;
static description = `Invalid snapshot id: {id}`;
}
class VmStartTimeoutError extends Error {
constructor(body, traceId) {
super(
`VM_START_TIMEOUT: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "VmStartTimeoutError";
}
static code = "VM_START_TIMEOUT";
static statusCode = 504;
static description = `VM did not become ready within the specified timeout`;
}
class VmIsSuspendingError extends Error {
constructor(body, traceId) {
super(
`VM_IS_SUSPENDING: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "VmIsSuspendingError";
}
static code = "VM_IS_SUSPENDING";
static statusCode = 409;
static description = `VM is currently being suspended`;
}
class VmExitDuringStartError extends Error {
constructor(body, traceId) {
super(
`VM_EXIT_DURING_START: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "VmExitDuringStartError";
}
static code = "VM_EXIT_DURING_START";
static statusCode = 500;
static description = `VM process exited unexpectedly during start`;
}
class VmAccessDeniedError extends Error {
constructor(body, traceId) {
super(
`VM_ACCESS_DENIED: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "VmAccessDeniedError";
}
static code = "VM_ACCESS_DENIED";
static statusCode = 403;
static description = `You do not have access to this VM`;
}
class FailedToSpawnUffdError extends Error {
constructor(body, traceId) {
super(
`FAILED_TO_SPAWN_UFFD: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "FailedToSpawnUffdError";
}
static code = "FAILED_TO_SPAWN_UFFD";
static statusCode = 500;
static description = `Failed to spawn UFFD handler '{daemon_name}'`;
}
class VmSpawnProcessError extends Error {
constructor(body, traceId) {
super(
`VM_SPAWN_PROCESS: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "VmSpawnProcessError";
}
static code = "VM_SPAWN_PROCESS";
static statusCode = 500;
static description = `Failed to spawn process for VM`;
}
class VmSubnetNotFoundError extends Error {
constructor(body, traceId) {
super(
`VM_SUBNET_NOT_FOUND: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "VmSubnetNotFoundError";
}
static code = "VM_SUBNET_NOT_FOUND";
static statusCode = 500;
static description = `Subnet for VM not found`;
}
class CreateVmMemNotPowerOfTwoError extends Error {
constructor(body, traceId) {
super(
`CREATE_VM_MEM_NOT_POWER_OF_TWO: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "CreateVmMemNotPowerOfTwoError";
}
static code = "CREATE_VM_MEM_NOT_POWER_OF_TWO";
static statusCode = 400;
static description = `memSizeMb must be a power of two in MiB (got {got} MiB)`;
}
class CreateVmVcpuNotPowerOfTwoError extends Error {
constructor(body, traceId) {
super(
`CREATE_VM_VCPU_NOT_POWER_OF_TWO: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "CreateVmVcpuNotPowerOfTwoError";
}
static code = "CREATE_VM_VCPU_NOT_POWER_OF_TWO";
static statusCode = 400;
static description = `vcpuCount must be a power of two (got {got})`;
}
class CreateVmRootfsOutOfRangeError extends Error {
constructor(body, traceId) {
super(
`CREATE_VM_ROOTFS_OUT_OF_RANGE: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "CreateVmRootfsOutOfRangeError";
}
static code = "CREATE_VM_ROOTFS_OUT_OF_RANGE";
static statusCode = 400;
static description = `rootfsSizeMb out of range (got {got} MB, allowed {min}..={max} MB)`;
}
class CreateVmMemOutOfRangeError extends Error {
constructor(body, traceId) {
super(
`CREATE_VM_MEM_OUT_OF_RANGE: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "CreateVmMemOutOfRangeError";
}
static code = "CREATE_VM_MEM_OUT_OF_RANGE";
static statusCode = 400;
static description = `memSizeMb out of range (got {got} MiB, allowed {min}..={max} MiB)`;
}
class CreateVmVcpuOutOfRangeError extends Error {
constructor(body, traceId) {
super(
`CREATE_VM_VCPU_OUT_OF_RANGE: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "CreateVmVcpuOutOfRangeError";
}
static code = "CREATE_VM_VCPU_OUT_OF_RANGE";
static statusCode = 400;
static description = `vcpuCount out of range (got {got}, allowed 1..={max})`;
}
class CreateVmBadRequestError extends Error {
constructor(body, traceId) {
super(
`CREATE_VM_BAD_REQUEST: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "CreateVmBadRequestError";
}
static code = "CREATE_VM_BAD_REQUEST";
static statusCode = 400;
static description = `Bad request: {message}`;
}
class VmSetupFailedError extends Error {
constructor(body, traceId) {
super(
`VM_SETUP_FAILED: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "VmSetupFailedError";
}
static code = "VM_SETUP_FAILED";
static statusCode = 500;
static description = `VM setup failed: {failed_reason}`;
}
class WantedByEmptyError extends Error {
constructor(body, traceId) {
super(
`WANTED_BY_EMPTY: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "WantedByEmptyError";
}
static code = "WANTED_BY_EMPTY";
static statusCode = 400;
static description = `wanted_by cannot be empty if provided`;
}
class WorkdirEmptyError extends Error {
constructor(body, traceId) {
super(
`WORKDIR_EMPTY: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "WorkdirEmptyError";
}
static code = "WORKDIR_EMPTY";
static statusCode = 400;
static description = `Working directory cannot be empty if provided`;
}
class GroupEmptyError extends Error {
constructor(body, traceId) {
super(
`GROUP_EMPTY: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "GroupEmptyError";
}
static code = "GROUP_EMPTY";
static statusCode = 400;
static description = `Group cannot be empty if provided`;
}
class UserEmptyError extends Error {
constructor(body, traceId) {
super(
`USER_EMPTY: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "UserEmptyError";
}
static code = "USER_EMPTY";
static statusCode = 400;
static description = `User cannot be empty if provided`;
}
class OnFailureArrayContainsEmptyError extends Error {
constructor(body, traceId) {
super(
`ON_FAILURE_ARRAY_CONTAINS_EMPTY: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "OnFailureArrayContainsEmptyError";
}
static code = "ON_FAILURE_ARRAY_CONTAINS_EMPTY";
static statusCode = 400;
static description = `'onFailure' array cannot contain empty strings`;
}
class RequiresArrayContainsEmptyError extends Error {
constructor(body, traceId) {
super(
`REQUIRES_ARRAY_CONTAINS_EMPTY: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "RequiresArrayContainsEmptyError";
}
static code = "REQUIRES_ARRAY_CONTAINS_EMPTY";
static statusCode = 400;
static description = `'requires' array cannot contain empty strings`;
}
class AfterArrayContainsEmptyError extends Error {
constructor(body, traceId) {
super(
`AFTER_ARRAY_CONTAINS_EMPTY: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "AfterArrayContainsEmptyError";
}
static code = "AFTER_ARRAY_CONTAINS_EMPTY";
static statusCode = 400;
static description = `'after' array cannot contain empty strings`;
}
class EnvKeyContainsEqualsError extends Error {
constructor(body, traceId) {
super(
`ENV_KEY_CONTAINS_EQUALS: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "EnvKeyContainsEqualsError";
}
static code = "ENV_KEY_CONTAINS_EQUALS";
static statusCode = 400;
static description = `Environment variable key '{key}' cannot contain '='`;
}
class EnvKeyEmptyError extends Error {
constructor(body, traceId) {
super(
`ENV_KEY_EMPTY: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "EnvKeyEmptyError";
}
static code = "ENV_KEY_EMPTY";
static statusCode = 400;
static description = `Environment variable key cannot be empty`;
}
class ExecEmptyError extends Error {
constructor(body, traceId) {
super(
`EXEC_EMPTY: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "ExecEmptyError";
}
static code = "EXEC_EMPTY";
static statusCode = 400;
static description = `Executable path (exec) cannot be empty`;
}
class ServiceNameTooLongError extends Error {
constructor(body, traceId) {
super(
`SERVICE_NAME_TOO_LONG: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "ServiceNameTooLongError";
}
static code = "SERVICE_NAME_TOO_LONG";
static statusCode = 400;
static description = `Service name '{name}' is too long (max {max_length} characters)`;
}
class ServiceNameInvalidPrefixError extends Error {
constructor(body, traceId) {
super(
`SERVICE_NAME_INVALID_PREFIX: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "ServiceNameInvalidPrefixError";
}
static code = "SERVICE_NAME_INVALID_PREFIX";
static statusCode = 400;
static description = `Service name '{name}' cannot start with '.' or '-'`;
}
class ServiceNameInvalidCharsError extends Error {
constructor(body, traceId) {
super(
`SERVICE_NAME_INVALID_CHARS: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "ServiceNameInvalidCharsError";
}
static code = "SERVICE_NAME_INVALID_CHARS";
static statusCode = 400;
static description = `Service name '{name}' contains invalid characters (/ or null)`;
}
class ServiceNameEmptyError extends Error {
constructor(body, traceId) {
super(
`SERVICE_NAME_EMPTY: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "ServiceNameEmptyError";
}
static code = "SERVICE_NAME_EMPTY";
static statusCode = 400;
static description = `Service name cannot be empty`;
}
class ServiceAlreadyExistsError extends Error {
constructor(body, traceId) {
super(
`SERVICE_ALREADY_EXISTS: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "ServiceAlreadyExistsError";
}
static code = "SERVICE_ALREADY_EXISTS";
static statusCode = 409;
static description = `Service '{service_name}' already exists`;
}
class ServiceNotFoundError extends Error {
constructor(body, traceId) {
super(
`SERVICE_NOT_FOUND: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "ServiceNotFoundError";
}
static code = "SERVICE_NOT_FOUND";
static statusCode = 404;
static description = `Service '{service_name}' not found`;
}
class InvalidRequestError extends Error {
constructor(body, traceId) {
super(
`INVALID_REQUEST: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "InvalidRequestError";
}
static code = "INVALID_REQUEST";
static statusCode = 400;
static description = `Invalid request: {message}`;
}
class RepoNotFoundError extends Error {
constructor(body, traceId) {
super(
`REPO_NOT_FOUND: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "RepoNotFoundError";
}
static code = "REPO_NOT_FOUND";
static statusCode = 404;
static description = `Repository not found: {repo_id}`;
}
class RuntimeErrorError extends Error {
constructor(body, traceId) {
super(
`RUNTIME_ERROR: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "RuntimeErrorError";
}
static code = "RUNTIME_ERROR";
static statusCode = 500;
static description = `The script execution resulted in a runtime error: {message}`;
}
class SyntaxErrorError extends Error {
constructor(body, traceId) {
super(
`SYNTAX_ERROR: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "SyntaxErrorError";
}
static code = "SYNTAX_ERROR";
static statusCode = 400;
static description = `The provided script has a syntax error: {message}`;
}
class InternalError extends Error {
constructor(body, traceId) {
super(
`INTERNAL: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "InternalError";
}
static code = "INTERNAL";
static statusCode = 500;
static description = `Internal error: {0}`;
}
class SigningError extends Error {
constructor(body, traceId) {
super(
`SIGNING: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "SigningError";
}
static code = "SIGNING";
static statusCode = 500;
static description = `Signing error`;
}
class InvalidSignatureError extends Error {
constructor(body, traceId) {
super(
`INVALID_SIGNATURE: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "InvalidSignatureError";
}
static code = "INVALID_SIGNATURE";
static statusCode = 403;
static description = `Invalid signature`;
}
class InvalidParametersError extends Error {
constructor(body, traceId) {
super(
`INVALID_PARAMETERS: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "InvalidParametersError";
}
static code = "INVALID_PARAMETERS";
static statusCode = 400;
static description = `Invalid parameters`;
}
class MaxUsesExceededError extends Error {
constructor(body, traceId) {
super(
`MAX_USES_EXCEEDED: ${body.message}${traceId ? `
TraceId: ${traceId}` : ""}`
);
this.body = body;
this.traceId = traceId;
this.name = "MaxUsesExceededError";
}
static code = "MAX_USES_EXCEEDED";
static statusCode = 403;
static description = `Session maximum uses exceeded`;
}
class ExpiredError extends Error {
constructor(body, traceId) {
super