{"version":3,"file":"utils.mjs","sources":["../../../../../src/runtime/internals/operations/utils.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\n// import { GraphQLFormattedError } from '@aws-amplify/data-schema-types';\n/**\n * Handle errors for list return types (list and index query operations)\n */\nexport function handleListGraphQlError(error) {\n    if (error?.errors) {\n        // graphql errors pass through\n        return {\n            ...error,\n            data: [],\n        };\n    }\n    else {\n        // non-graphql errors are re-thrown\n        throw error;\n    }\n}\n/**\n * Handle errors for singular return types (create, get, update, delete operations)\n */\nexport function handleSingularGraphQlError(error) {\n    if (error.errors) {\n        // graphql errors pass through\n        return {\n            ...error,\n            data: null,\n        };\n    }\n    else {\n        // non-graphql errors are re-thrown\n        throw error;\n    }\n}\n"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,sBAAsB,CAAC,KAAK,EAAE;AAC9C,IAAI,IAAI,KAAK,EAAE,MAAM,EAAE;AACvB;AACA,QAAQ,OAAO;AACf,YAAY,GAAG,KAAK;AACpB,YAAY,IAAI,EAAE,EAAE;AACpB,SAAS;AACT,IAAI;AACJ,SAAS;AACT;AACA,QAAQ,MAAM,KAAK;AACnB,IAAI;AACJ;AACA;AACA;AACA;AACO,SAAS,0BAA0B,CAAC,KAAK,EAAE;AAClD,IAAI,IAAI,KAAK,CAAC,MAAM,EAAE;AACtB;AACA,QAAQ,OAAO;AACf,YAAY,GAAG,KAAK;AACpB,YAAY,IAAI,EAAE,IAAI;AACtB,SAAS;AACT,IAAI;AACJ,SAAS;AACT;AACA,QAAQ,MAAM,KAAK;AACnB,IAAI;AACJ;;;;"}