UNPKG

@genkit-ai/core

Version:

Genkit AI framework core libraries.

1 lines 1.37 kB
{"version":3,"sources":["../src/error.ts"],"sourcesContent":["/**\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { StatusName } from './statusTypes.js';\n\nexport class GenkitError extends Error {\n source?: string;\n status: StatusName;\n detail?: any;\n\n constructor({\n status,\n message,\n detail,\n source,\n }: {\n status: StatusName;\n message: string;\n detail?: any;\n source?: string;\n }) {\n super(`${source ? `${source}: ` : ''}${status}: ${message}`);\n this.status = status;\n this.detail = detail;\n }\n}\n"],"mappings":";AAkBO,MAAM,oBAAoB,MAAM;AAAA,EAKrC,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAKG;AACD,UAAM,GAAG,SAAS,GAAG,MAAM,OAAO,EAAE,GAAG,MAAM,KAAK,OAAO,EAAE;AAC3D,SAAK,SAAS;AACd,SAAK,SAAS;AAAA,EAChB;AACF;","names":[]}