{"version":3,"file":"InvalidAmplifyContextError.mjs","sources":["../../../src/errors/InvalidAmplifyContextError.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 * Stable error name/code thrown when a value is passed where an\n * {@link AmplifyContext} is expected, but it is not a branded context (e.g. a\n * plain options object or an `AmplifyClass` instance was mistakenly passed in\n * the context position). Exposed as a constant so category packages can catch\n * this failure by name without importing the class.\n */\nexport const INVALID_AMPLIFY_CONTEXT_ERROR_NAME = 'InvalidAmplifyContextError';\n/**\n * Thrown when a defined-but-unbranded value is supplied where an\n * {@link AmplifyContext} is required (e.g. category class constructors that\n * accept an optional leading context argument).\n *\n * Uses core's {@link AmplifyError} machinery so consumers can catch it via\n * `instanceof AmplifyError` / `instanceof InvalidAmplifyContextError`, or by the\n * stable `name` ({@link INVALID_AMPLIFY_CONTEXT_ERROR_NAME}).\n */\nexport class InvalidAmplifyContextError extends AmplifyError {\n    constructor(message = 'Invalid AmplifyContext. The value passed in the context position is not a ' +\n        'branded AmplifyContext.') {\n        super({\n            name: INVALID_AMPLIFY_CONTEXT_ERROR_NAME,\n            message,\n            recoverySuggestion: 'Pass an AmplifyContext created via createAmplifyContext() (or Amplify.configure()), ' +\n                'or omit the argument to use the global context.',\n        });\n        // Hack for making the custom error class work when transpiled to es5.\n        this.constructor = InvalidAmplifyContextError;\n        Object.setPrototypeOf(this, InvalidAmplifyContextError.prototype);\n    }\n}\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,kCAAkC,GAAG;AAClD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAM,0BAA0B,SAAS,YAAY,CAAC;AAC7D,IAAI,WAAW,CAAC,OAAO,GAAG,4EAA4E;AACtG,QAAQ,yBAAyB,EAAE;AACnC,QAAQ,KAAK,CAAC;AACd,YAAY,IAAI,EAAE,kCAAkC;AACpD,YAAY,OAAO;AACnB,YAAY,kBAAkB,EAAE,sFAAsF;AACtH,gBAAgB,iDAAiD;AACjE,SAAS,CAAC;AACV;AACA,QAAQ,IAAI,CAAC,WAAW,GAAG,0BAA0B;AACrD,QAAQ,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,0BAA0B,CAAC,SAAS,CAAC;AACzE,IAAI;AACJ;;;;"}