{"version":3,"file":"APIError.mjs","sources":["../../../src/errors/APIError.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { AmplifyError } from './AmplifyError';\n/**\n * Error class for errors that associated with unsuccessful HTTP responses.\n * It's throw by API category REST API handlers and GraphQL query handlers for now.\n */\nexport class ApiError extends AmplifyError {\n    /**\n     * The unwrapped HTTP response causing the given API error.\n     */\n    get response() {\n        return this._response\n            ? replicateApiErrorResponse(this._response)\n            : undefined;\n    }\n    constructor(params) {\n        super(params);\n        // TODO: Delete the following 2 lines after we change the build target to >= es2015\n        this.constructor = ApiError;\n        Object.setPrototypeOf(this, ApiError.prototype);\n        if (params.response) {\n            this._response = params.response;\n        }\n    }\n}\nconst replicateApiErrorResponse = (response) => ({\n    ...response,\n    headers: { ...response.headers },\n});\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACA;AACA;AACA;AACO,MAAM,QAAQ,SAAS,YAAY,CAAC;AAC3C;AACA;AACA;AACA,IAAI,IAAI,QAAQ,GAAG;AACnB,QAAQ,OAAO,IAAI,CAAC;AACpB,cAAc,yBAAyB,CAAC,IAAI,CAAC,SAAS;AACtD,cAAc,SAAS;AACvB,IAAI;AACJ,IAAI,WAAW,CAAC,MAAM,EAAE;AACxB,QAAQ,KAAK,CAAC,MAAM,CAAC;AACrB;AACA,QAAQ,IAAI,CAAC,WAAW,GAAG,QAAQ;AACnC,QAAQ,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC;AACvD,QAAQ,IAAI,MAAM,CAAC,QAAQ,EAAE;AAC7B,YAAY,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,QAAQ;AAC5C,QAAQ;AACR,IAAI;AACJ;AACA,MAAM,yBAAyB,GAAG,CAAC,QAAQ,MAAM;AACjD,IAAI,GAAG,QAAQ;AACf,IAAI,OAAO,EAAE,EAAE,GAAG,QAAQ,CAAC,OAAO,EAAE;AACpC,CAAC,CAAC;;;;"}