{"version":3,"file":"errors.mjs","names":[],"sources":["../../src/utils/errors.ts"],"sourcesContent":["// Copyright (c) Mysten Labs, Inc.\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * @description Base class for DeepBook errors\n */\nexport class DeepBookError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = 'DeepBookError';\n\t}\n}\n\n/**\n * @description Error thrown when a resource is not found\n */\nexport class ResourceNotFoundError extends DeepBookError {\n\tconstructor(resourceType: string, key: string) {\n\t\tsuper(`${resourceType} not found for key: ${key}`);\n\t\tthis.name = 'ResourceNotFoundError';\n\t}\n}\n\n/**\n * @description Error thrown when configuration is invalid or missing\n */\nexport class ConfigurationError extends DeepBookError {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = 'ConfigurationError';\n\t}\n}\n\n/**\n * @description Error thrown when transaction validation fails\n */\nexport class ValidationError extends DeepBookError {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = 'ValidationError';\n\t}\n}\n\n/**\n * @description Standard error messages\n */\nexport const ErrorMessages = {\n\t// Configuration errors\n\tADMIN_CAP_NOT_SET: 'Admin capability not configured',\n\tMARGIN_ADMIN_CAP_NOT_SET: 'Margin admin capability not configured',\n\tMARGIN_MAINTAINER_CAP_NOT_SET: 'Margin maintainer capability not configured',\n\n\t// Resource errors\n\tCOIN_NOT_FOUND: (key: string) => `Coin not found for key: ${key}`,\n\tPOOL_NOT_FOUND: (key: string) => `Pool not found for key: ${key}`,\n\tMARGIN_POOL_NOT_FOUND: (key: string) => `Margin pool not found for key: ${key}`,\n\tBALANCE_MANAGER_NOT_FOUND: (key: string) => `Balance manager with key ${key} not found`,\n\tMARGIN_MANAGER_NOT_FOUND: (key: string) => `Margin manager with key ${key} not found`,\n\tPRICE_INFO_NOT_FOUND: (coinKey: string) => `Price info object not found for ${coinKey}`,\n\n\t// Validation errors\n\tINVALID_ARGUMENT_COUNT: (expected: number, got: number) =>\n\t\t`Invalid number of arguments, expected ${expected}, got ${got}`,\n\tPARAMETER_REQUIRED: (name: string) => `Parameter ${name} is required`,\n\tINVALID_ARGUMENT: (arg: string, type: string) => `Invalid argument ${arg} for type ${type}`,\n\tINVALID_ADDRESS: 'Address must be a valid Sui address',\n} as const;\n"],"mappings":";;;;AAMA,IAAa,gBAAb,cAAmC,MAAM;CACxC,YAAY,SAAiB;AAC5B,QAAM,QAAQ;AACd,OAAK,OAAO;;;;;;AAOd,IAAa,wBAAb,cAA2C,cAAc;CACxD,YAAY,cAAsB,KAAa;AAC9C,QAAM,GAAG,aAAa,sBAAsB,MAAM;AAClD,OAAK,OAAO;;;;;;AAOd,IAAa,qBAAb,cAAwC,cAAc;CACrD,YAAY,SAAiB;AAC5B,QAAM,QAAQ;AACd,OAAK,OAAO;;;;;;AAOd,IAAa,kBAAb,cAAqC,cAAc;CAClD,YAAY,SAAiB;AAC5B,QAAM,QAAQ;AACd,OAAK,OAAO;;;;;;AAOd,MAAa,gBAAgB;CAE5B,mBAAmB;CACnB,0BAA0B;CAC1B,+BAA+B;CAG/B,iBAAiB,QAAgB,2BAA2B;CAC5D,iBAAiB,QAAgB,2BAA2B;CAC5D,wBAAwB,QAAgB,kCAAkC;CAC1E,4BAA4B,QAAgB,4BAA4B,IAAI;CAC5E,2BAA2B,QAAgB,2BAA2B,IAAI;CAC1E,uBAAuB,YAAoB,mCAAmC;CAG9E,yBAAyB,UAAkB,QAC1C,yCAAyC,SAAS,QAAQ;CAC3D,qBAAqB,SAAiB,aAAa,KAAK;CACxD,mBAAmB,KAAa,SAAiB,oBAAoB,IAAI,YAAY;CACrF,iBAAiB;CACjB"}