{"version":3,"file":"errors.mjs","names":["code: string"],"sources":["../src/errors.ts"],"sourcesContent":["/**\n * Base error for all uniku errors.\n * Provides `_tag` for discriminated matching (compatible with Effect's `catchTag`)\n * and `code` for machine-readable error identification.\n */\nexport abstract class UniqueIdError extends Error {\n  abstract readonly _tag: string\n  abstract readonly code: string\n\n  constructor(message: string) {\n    super(message)\n    this.name = this.constructor.name\n  }\n}\n\n/**\n * Thrown when generator arguments are invalid (bad size, alphabet, length, timestamp, version).\n */\nexport class InvalidInputError extends UniqueIdError {\n  readonly _tag = 'InvalidInputError' as const\n\n  constructor(\n    readonly code: string,\n    message: string,\n  ) {\n    super(message)\n  }\n}\n\n/**\n * Thrown when parsing/decoding an ID string that has invalid format or characters.\n */\nexport class ParseError extends UniqueIdError {\n  readonly _tag = 'ParseError' as const\n\n  constructor(\n    readonly code: string,\n    message: string,\n  ) {\n    super(message)\n  }\n}\n\n/**\n * Thrown when a byte array or buffer is too short or an offset is out of bounds.\n */\nexport class BufferError extends UniqueIdError {\n  readonly _tag = 'BufferError' as const\n\n  constructor(\n    readonly code: string,\n    message: string,\n  ) {\n    super(message)\n  }\n}\n"],"mappings":"AAKA,IAAsB,EAAtB,cAA4C,KAAM,CAIhD,YAAY,EAAiB,CAC3B,MAAM,EAAQ,CACd,KAAK,KAAO,KAAK,YAAY,OAOpB,EAAb,cAAuC,CAAc,CACnD,KAAgB,oBAEhB,YACE,EACA,EACA,CACA,MAAM,EAAQ,CAHL,KAAA,KAAA,IAUA,EAAb,cAAgC,CAAc,CAC5C,KAAgB,aAEhB,YACE,EACA,EACA,CACA,MAAM,EAAQ,CAHL,KAAA,KAAA,IAUA,EAAb,cAAiC,CAAc,CAC7C,KAAgB,cAEhB,YACE,EACA,EACA,CACA,MAAM,EAAQ,CAHL,KAAA,KAAA"}