UNPKG

@adobe/pdfservices-node-sdk

Version:

The Adobe PDF Services Node.js SDK provides APIs for creating, combining, exporting and manipulating PDFs.

81 lines 3.01 kB
"use strict"; /* * Copyright 2024 Adobe * All Rights Reserved. * * NOTICE: Adobe permits you to use, modify, and distribute this file in * accordance with the terms of the Adobe license agreement accompanying * it. If you have received this file from a source other than Adobe, * then your use, modification, or distribution of it requires the prior * written permission of Adobe. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.ServiceUsageError = void 0; /** * ServiceUsageError is thrown when either Service usage limit has been reached or credentials quota has been * exhausted. * * @see {@link SDKError} * @see {@link ServiceApiError} */ class ServiceUsageError extends Error { /** * Constructs a `ServiceUsageError` with the specified detail message, request tracking id, status code and * error code. * @param message error message detail * @param requestTrackingId X-Request-Id header value to track the request * @param statusCode HTTP Status code returned in API response * @param errorCode Error code returned in API response */ constructor(message, requestTrackingId, statusCode, errorCode) { super(message); this._requestTrackingId = requestTrackingId; this._statusCode = statusCode ?? ServiceUsageError.DEFAULT_STATUS_CODE; this._errorCode = errorCode ?? ServiceUsageError.DEFAULT_ERROR_CODE; } /** * Returns the detail message of this error. * * @returns the message detail. */ get message() { return `description ='${super.message}'; requestTrackingId='${this.requestTrackingId}'; statusCode=${this.statusCode}; errorCode=${this.errorCode}`; } /** * Returns the Request ID (the value of the X-Request-ID header). * * @returns Request ID */ get requestTrackingId() { return this._requestTrackingId; } /** * Returns the HTTP Status code or `DEFAULT_STATUS_CODE=429` if the status code doesn't adequately represent * the error. * * @returns the HTTP Status code or `DEFAULT_STATUS_CODE=429` if the status code doesn't adequately represent * the error. */ get statusCode() { return this._statusCode; } /** * Returns the Error code or `DEFAULT_ERROR_CODE="TOO_MANY_REQUESTS"` if the error code doesn't adequately represent the error. * * @returns the Error code or `DEFAULT_ERROR_CODE="TOO_MANY_REQUESTS"` if the error code doesn't adequately represent the error. */ get errorCode() { return this._errorCode; } } exports.ServiceUsageError = ServiceUsageError; /** * the default value of status code if there is no status code for this service failure. */ ServiceUsageError.DEFAULT_STATUS_CODE = 429; /** * the default value of error code if there is no error code for this service failure. */ ServiceUsageError.DEFAULT_ERROR_CODE = "TOO_MANY_REQUESTS"; //# sourceMappingURL=ServiceUsageError.js.map