@sapphire/framework
Version:
Discord bot framework built for advanced and amazing bots.
1 lines • 1.71 kB
Source Map (JSON)
{"version":3,"sources":["../../../../src/lib/errors/PreconditionError.ts"],"names":[],"mappings":";;;AAOO,IAAM,kBAAA,GAAN,MAAM,kBAAA,SAA0B,SAAU,CAAA;AAAA,EAGzC,YAAY,OAAoC,EAAA;AACtD,IAAM,KAAA,CAAA,EAAE,GAAG,OAAS,EAAA,UAAA,EAAY,QAAQ,UAAc,IAAA,OAAA,CAAQ,YAAa,CAAA,IAAA,EAAM,CAAA;AACjF,IAAA,IAAA,CAAK,eAAe,OAAQ,CAAA,YAAA;AAAA;AAC7B;AAAA,EAGA,IAAoB,IAAe,GAAA;AAClC,IAAO,OAAA,mBAAA;AAAA;AAET,CAAA;AAZiD,MAAA,CAAA,kBAAA,EAAA,mBAAA,CAAA;AAA1C,IAAM,iBAAN,GAAA","file":"PreconditionError.mjs","sourcesContent":["import type { Precondition } from '../structures/Precondition';\nimport { UserError } from './UserError';\n\n/**\n * Errors thrown by preconditions\n * @property name This will be `'PreconditionError'` and can be used to distinguish the type of error when any error gets thrown\n */\nexport class PreconditionError extends UserError {\n\tpublic readonly precondition: Precondition;\n\n\tpublic constructor(options: PreconditionError.Options) {\n\t\tsuper({ ...options, identifier: options.identifier ?? options.precondition.name });\n\t\tthis.precondition = options.precondition;\n\t}\n\n\t// eslint-disable-next-line @typescript-eslint/class-literal-property-style\n\tpublic override get name(): string {\n\t\treturn 'PreconditionError';\n\t}\n}\n\nexport namespace PreconditionError {\n\t/**\n\t * The options for {@link PreconditionError}.\n\t * @since 1.0.0\n\t */\n\texport interface Options extends Omit<UserError.Options, 'identifier'> {\n\t\t/**\n\t\t * The precondition that caused the error.\n\t\t * @since 1.0.0\n\t\t */\n\t\tprecondition: Precondition;\n\n\t\t/**\n\t\t * The identifier.\n\t\t * @since 1.0.0\n\t\t * @default precondition.name\n\t\t */\n\t\tidentifier?: string;\n\t}\n}\n"]}