UNPKG

@scaleway/sdk-client

Version:
32 lines (31 loc) 961 B
"use strict"; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); const scwError = require("../scw-error.cjs"); class TransientStateError extends scwError.ScalewayError { constructor(status, body, resource, resourceId, currentState) { super( status, body, `resource ${resource} with ID ${resourceId} is in a transient state: ${currentState}` ); this.status = status; this.body = body; this.resource = resource; this.resourceId = resourceId; this.currentState = currentState; this.name = "TransientStateError"; } static fromJSON(status, obj) { if (typeof obj.resource !== "string" || typeof obj.resource_id !== "string" || typeof obj.current_state !== "string") { return null; } return new TransientStateError( status, obj, obj.resource, obj.resource_id, obj.current_state ); } } exports.TransientStateError = TransientStateError;