@seedcord/errors 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
  <a href="https://seedcord.org">Website</a> ·
11
11
  <a href="https://seedcord.org/guide">Guide</a> ·
12
12
  <a href="https://seedcord.org/docs">Reference</a> ·
13
- <a href="https://discord.gg/DzFxY58WXf">Discord</a>
13
+ <a href="https://seedcord.org/chat/">Discord</a>
14
14
  </div>
15
15
 
16
16
  <br />
@@ -23,33 +23,31 @@
23
23
 
24
24
  ## About
25
25
 
26
- `@seedcord/errors` holds every error seedcord throws. Each one carries a registered code from `SeedcordErrorCode`, so a caller can branch on one specific failure.
26
+ `@seedcord/errors` defines the codes for every error seedcord throws, in `SeedcordErrorCode`. `isSeedcordError` checks a caught value against a code, so your code can react to one specific failure.
27
27
 
28
- Framework code never throws a raw `Error`. A third-party throw may be translated into one of these before you catch it.
28
+ Both seedcord transports depend on it and re-export it, so a bot imports `isSeedcordError` from its transport. Install it directly in a plugin or a library that catches errors from a seedcord package, like [`@seedcord/custom-id`](https://www.npmjs.com/package/@seedcord/custom-id) in a discord.js bot.
29
29
 
30
- Until v1.0.0, minor versions can break.
30
+ seedcord is pre-1.0, so a minor version can break your code. Each release's changelog says what changed and how to update.
31
31
 
32
32
  ## Installation
33
33
 
34
- Your transport already re-exports this.
35
-
36
34
  ```sh
37
35
  pnpm add @seedcord/errors
38
36
  ```
39
37
 
40
38
  ## Usage
41
39
 
42
- `isSeedcordError` narrows on the class and the code together:
40
+ Say `Approve` is a `CustomId` from `@seedcord/custom-id`, and a click arrives on a button built from an older version of it:
43
41
 
44
42
  ```ts
45
43
  import { isSeedcordError, SeedcordErrorCode } from '@seedcord/errors';
46
44
 
47
45
  try {
48
- await run();
46
+ Approve.decode(interaction.customId);
49
47
  } catch (error) {
50
- if (isSeedcordError(error, 'SeedcordError', SeedcordErrorCode.CliCancelled)) return;
51
- throw error;
48
+ if (!isSeedcordError(error, 'SeedcordError', SeedcordErrorCode.CustomIdWireStale)) throw error;
49
+ await interaction.reply('This button is out of date. Run the command again.');
52
50
  }
53
51
  ```
54
52
 
55
- Called with one argument it narrows to any seedcord error.
53
+ The [error handling guide](https://seedcord.org/guide/replying/error-behavior) covers how a seedcord bot replies to an error.
@@ -0,0 +1,583 @@
1
+ import { ColorSupportLevel } from "chalk";
2
+ //#region src/ErrorCodes.d.ts
3
+ /**
4
+ * All Seedcord error codes.
5
+ */
6
+ declare enum SeedcordErrorCode {
7
+ /** Two or more configured emojis failed to resolve at startup. */
8
+ ConfigEmojiUnresolved = 1001,
9
+ /** A configured emoji is neither a name nor a `[name, guildId]` pair. */
10
+ ConfigEmojiInvalid = 1002,
11
+ /** The application or guild a configured emoji points at has no emoji with that name. */
12
+ ConfigEmojiNotFound = 1003,
13
+ /** Reading the emojis of the application or guild a configured emoji points at failed. */
14
+ ConfigEmojiSourceUnreadable = 1004,
15
+ /** Discord has no webhook at a configured URL, because it was deleted or the id or token is wrong. */
16
+ ConfigWebhookNotFound = 1005,
17
+ /** A required environment variable is unset. */
18
+ ConfigMissingEnv = 1006,
19
+ /** An environment variable is set to a value seedcord cannot use. */
20
+ ConfigInvalidEnv = 1007,
21
+ /** A command that runs in guilds is registered without the `Guilds` intent, so discord.js caches no guild. */
22
+ MissingGuildsIntent = 1008,
23
+ /** The running Node or Bun is older than the range seedcord declares in `engines`. */
24
+ UnsupportedRuntimeVersion = 1009,
25
+ /** An edge config sets a REST sweeper interval. */
26
+ ConfigEdgeRestSweeper = 1010,
27
+ /** Another process already listens on the port seedcord tries to listen on. */
28
+ PortInUse = 1011,
29
+ /** A startup task was added or removed while startup ran, or added after it finished. */
30
+ LifecycleTaskChangeRejected = 1101,
31
+ /** A lifecycle call got a phase that is not a member of `StartupPhase` or `ShutdownPhase`. */
32
+ LifecycleUnknownPhase = 1102,
33
+ /** One or more tasks failed during a startup phase. */
34
+ LifecyclePhaseFailures = 1103,
35
+ /** A lifecycle task ran past its timeout. */
36
+ LifecycleTaskTimeout = 1104,
37
+ /** A host whose startup failed was started again. */
38
+ LifecycleRestartAfterFailure = 1105,
39
+ /** A shutdown deadline or a plugin's lifecycle timeout is zero, negative, or not finite. */
40
+ LifecycleInvalidTimeout = 1106,
41
+ /** A second Seedcord instance was constructed while one already exists. */
42
+ CoreSingletonViolation = 1201,
43
+ /** A plugin was attached after the bot started. */
44
+ CorePluginAfterInit = 1202,
45
+ /** A plugin was attached under a key another plugin already uses. */
46
+ CorePluginKeyExists = 1203,
47
+ /** The bot's own role is missing from the guild's role cache. */
48
+ CoreBotRoleMissing = 1204,
49
+ /** A bot controller was constructed without the folder that holds its handlers. */
50
+ CoreControllerPathMissing = 1205,
51
+ /** seedcord could not import a file in the bot or in the CLI. */
52
+ CoreImportFailed = 1206,
53
+ /** A file or folder that seedcord reads could not be read. */
54
+ CorePathUnreadable = 1207,
55
+ /** A plugin was attached under a key that the framework logs on. */
56
+ CorePluginReservedChannel = 1208,
57
+ /** The application id was read before startup resolved it. */
58
+ CoreApplicationUnavailable = 1209,
59
+ /** A generated accessor like `Emojis` or `Commands` was read for a key that has no value yet. */
60
+ CoreAccessorUnresolved = 1210,
61
+ /** A shutdown task was added on an edge bot. Cloudflare stops an isolate without a shutdown hook. */
62
+ CoreLifecycleUnavailable = 1211,
63
+ /** `emit` was called on the bus. It calls the listeners and skips every subscriber. */
64
+ CoreBusEmitUnavailable = 1212,
65
+ /** A command registers to the `'config'` guilds while `commands.guilds` is empty. */
66
+ CoreCommandGuildsEmpty = 1213,
67
+ /** Discord refused the command deploy for one guild. */
68
+ CoreCommandGuildDeployFailed = 1214,
69
+ /** A plugin was attached under a group name the bot already uses. */
70
+ CorePluginGroupTaken = 1215,
71
+ /** A plugin was attached at a name that holds a group of plugins. */
72
+ CorePluginKeyHoldsGroup = 1216,
73
+ /** A plugin key is empty, has an empty part, or has more than one dot. */
74
+ CorePluginKeyMalformed = 1217,
75
+ /** An attached plugin extends the `Plugin` class of a different copy of `@seedcord/core`. */
76
+ CorePluginFromOtherCore = 1218,
77
+ /** A folder or the `build.start` file is outside `root`. */
78
+ CorePathOutsideRoot = 1219,
79
+ /** A plugin declares a transport or runtime the bot doesn't use. */
80
+ CorePluginScopeMismatch = 1220,
81
+ /** A node http bot got a request through `fetch` before `start()` was called. */
82
+ CoreFetchBeforeStart = 1221,
83
+ /** An edge worker got a POST without the ids that `seedcord build` writes into it. */
84
+ CoreEdgeUnbuilt = 1222,
85
+ /** A relative folder was read in a process that never got the bot's `root`. */
86
+ CoreDirectoryRootUnknown = 1223,
87
+ /** Discord refused the global command deploy. */
88
+ CoreCommandGlobalDeployFailed = 1224,
89
+ /** A built bot read a folder that did not exist under `root` when `seedcord build` ran. */
90
+ CoreDirectoryNotBuilt = 1225,
91
+ /** A webhook sender was constructed with a URL that is not a Discord webhook URL. */
92
+ CoreWebhookUrlInvalid = 1226,
93
+ /** Reading from Discord with `DISCORD_BOT_TOKEN` failed, like the application, its public key, or its commands. */
94
+ CoreDiscordReadFailed = 1227,
95
+ /** Two routes, commands, migrations, or customId fields have the same name, or two code files build to the same file. */
96
+ CoreDuplicateName = 1228,
97
+ /** A Vite plugin from `vitePlugins` threw while Vite started or loaded a file, or failed when seedcord called `vitePlugins`. */
98
+ CoreVitePluginThrew = 1229,
99
+ /** `readFiles` read a folder that `files` in `seedcord.config.ts` leaves out. */
100
+ CoreDirectoryNotListed = 1230,
101
+ /** A folder is inside one that `seedcord build` skips, like a dot-folder, `node_modules`, `outDir` or the logs folder. */
102
+ CoreDirectorySkipped = 1231,
103
+ /** A command class carries `@RegisterCommand` twice. */
104
+ DecoratorCommandAlreadyRegistered = 1301,
105
+ /** `@RegisterCommand('global')` was given guild ids. */
106
+ DecoratorCommandGlobalWithGuilds = 1302,
107
+ /** `@RegisterCommand('guild')` was given no guild ids. */
108
+ DecoratorCommandGuildWithoutGuilds = 1303,
109
+ /** A middleware decorator sets a priority that is not a finite number. */
110
+ DecoratorInvalidMiddlewarePriority = 1304,
111
+ /** A `WebhookLog` subclass is missing its `@WebhookUrl` decorator. */
112
+ DecoratorWebhookUrlMissing = 1305,
113
+ /** A middleware decorator got an empty filter array. */
114
+ DecoratorEmptyMiddlewareFilter = 1306,
115
+ /** A reply method was called in an ack state where Discord rejects it. */
116
+ ReplyIllegalAckState = 1501,
117
+ /** A reply component threw while seedcord serialized it. */
118
+ ReplyComponentSerialization = 1502,
119
+ /** `edit()` got a message that the interaction did not send. */
120
+ ReplyForeignEditTarget = 1503,
121
+ /** `update()` or `deferUpdate()` was called on a modal that has no source message. */
122
+ ReplyUpdateWithoutSource = 1504,
123
+ /** Discord's response to a `withResponse` callback has no message in it. */
124
+ ReplyCallbackMissingMessage = 1505,
125
+ /** A customId prefix is empty, or holds a colon or a control character. */
126
+ CustomIdInvalidPrefix = 1601,
127
+ /** A customId field name looks like an integer. JS reorders integer keys. */
128
+ CustomIdReservedFieldName = 1602,
129
+ /** A `oneOf()` or `someOf()` field was declared with no choices. */
130
+ CustomIdEmptyChoices = 1603,
131
+ /** An `int()` field was declared with a min greater than its max. */
132
+ CustomIdInvalidBounds = 1604,
133
+ /** `encode()` got a value that doesn't fit its field. */
134
+ CustomIdValueRejected = 1605,
135
+ /** An encoded customId is longer than the 100 characters Discord allows. */
136
+ CustomIdWireTooLong = 1606,
137
+ /** A component handler is missing the route decorator that matches its base. */
138
+ CustomIdHandlerRouteMissing = 1607,
139
+ /** A handler's `match()` has no arm for the route, field, event, or command that fired. */
140
+ MatchArmMissing = 1608,
141
+ /** An event handler or middleware read the fired event's name but was constructed without one. */
142
+ EventNameUnavailable = 1609,
143
+ /** Discord sent an autocomplete payload with no focused option. */
144
+ AutocompleteNoFocusedOption = 1610,
145
+ /** The submitted modal has no field with the requested custom id. */
146
+ ModalFieldNotFound = 1611,
147
+ /** A modal field getter was called on a field of another kind. */
148
+ ModalFieldWrongKind = 1612,
149
+ /** A modal field read as required has nothing picked. */
150
+ ModalFieldEmpty = 1613,
151
+ /** A channel select returned a channel whose type the `getSelectedChannels()` call excludes. */
152
+ ModalFieldChannelType = 1614,
153
+ /** A customId was encoded under an older shape of the same definition. */
154
+ CustomIdWireStale = 1615,
155
+ /** A customId is corrupt, truncated, or was encoded by a different definition. */
156
+ CustomIdWireInvalid = 1616,
157
+ /** `dispatch.require()` was called for a key that nothing set on this dispatch. */
158
+ DispatchStateMissing = 1617,
159
+ /** A `Cooldown` gate got a duration that doesn't parse, or one of zero or less. */
160
+ GateInvalidCooldownDuration = 1701,
161
+ /** A paginator got a `perPage` that is not a positive integer. */
162
+ PaginationInvalidPerPage = 1801,
163
+ /** A control row has no controls, or more than the five buttons Discord allows. */
164
+ PaginationControlCount = 1802,
165
+ /** A control row lists the same control twice. Its two buttons would share a custom_id. */
166
+ PaginationDuplicateControls = 1803,
167
+ /** A color value doesn't resolve to a Discord color integer. */
168
+ ColorUnresolvable = 1901,
169
+ /** A resolved color is outside Discord's range of 0x000000 to 0xffffff. */
170
+ ColorOutOfRange = 1902,
171
+ /** `renderTable` got a `maxWidth` or `padding` outside the values it accepts. */
172
+ UtilTableOptionInvalid = 1951,
173
+ /** `assertNever` ran with a value that its types ruled out. */
174
+ UtilUnhandledUnionMember = 1952,
175
+ /** `WinstonFileSink` got a `filename` with a folder in it. File logs always go in the logs folder. */
176
+ LoggerFileNameHasFolder = 1971,
177
+ /** A plugin's constructor called `rejectOptions` on the options it got. */
178
+ PluginOptionsRejected = 2001,
179
+ /** Two or more plugins threw while disposing. */
180
+ PluginDisposeFailures = 2002,
181
+ /** A plugin service class is missing the decorator that registers it. */
182
+ PluginServiceDecoratorMissing = 2003,
183
+ /** A plugin's `services` was read before the plugin finished `init()`. */
184
+ PluginServicesNotReady = 2004,
185
+ /** A plugin could not connect to the service it wraps. */
186
+ PluginConnectionFailed = 2005,
187
+ /** A plugin could not close its connection cleanly during shutdown. */
188
+ PluginDisconnectFailed = 2006,
189
+ /** Mongoose threw while building a model, usually for a duplicate model name or a missing schema. */
190
+ PluginMongooseModelCreationFailed = 2101,
191
+ /** A mongoose service was registered with an empty model name. */
192
+ PluginMongooseModelNameMissing = 2102,
193
+ /** A kysely service class has no table. */
194
+ PluginKyselyServiceTableMissing = 2201,
195
+ /** A migration run got a step count that is not a non-negative integer. */
196
+ PluginKyselyInvalidStepCount = 2202,
197
+ /** A migration run got a direction other than `up` or `down`. */
198
+ PluginKyselyUnknownDirection = 2203,
199
+ /** A file in the migrations folder has no `up` function. */
200
+ PluginKyselyInvalidMigrationModule = 2204,
201
+ /** A migration failed with a thrown value that is not an `Error`. */
202
+ PluginKyselyNonErrorFailure = 2205,
203
+ /** Creating the target Postgres database failed. */
204
+ PluginKyselyBootstrapFailed = 2206,
205
+ /** Someone pressed Ctrl-C at a prompt in `seedcord` or `create-seedcord`. */
206
+ CliCancelled = 3001,
207
+ /** The seedcord config file's default export is not an object. */
208
+ CliConfigInvalidExport = 3101,
209
+ /** No seedcord config file exists in the folder the CLI searched. */
210
+ CliConfigNotFound = 3102,
211
+ /** The file that `instance` or `build.start` in the seedcord config points at does not exist. */
212
+ CliFileNotFound = 3103,
213
+ /** The instance file's default export is not a constructed `Seedcord`. */
214
+ CliInstanceInvalid = 3104,
215
+ /** The bot threw during startup. */
216
+ CliStartFailed = 3105,
217
+ /** `build.tsconfig` points at a missing file, or it is unset and the config's folder has no `tsconfig.json`. */
218
+ CliTsconfigNotFound = 3106,
219
+ /** `seedcord build` found type errors. */
220
+ CliBuildFailed = 3107,
221
+ /** `commands clean` or `commands purge` ran without a flag that picks where it deletes. */
222
+ CliNoScopeGiven = 3108,
223
+ /** cloudflared never reported a quick tunnel hostname. */
224
+ CliTunnelUrlUnavailable = 3109,
225
+ /** Discord rejected the tunnel URL as an interactions endpoint. */
226
+ CliTunnelNotVerified = 3110,
227
+ /** The tunnel URL never answered its health probe. */
228
+ CliTunnelUnreachable = 3111,
229
+ /** A field in the seedcord config is missing or has the wrong shape. */
230
+ CliConfigInvalidField = 3112,
231
+ /** A class carrying `@RegisterCommand` threw while seedcord constructed it. */
232
+ CliCommandConstructorThrew = 3113,
233
+ /** Vite threw while bundling the bot. */
234
+ CliBundleFailed = 3114,
235
+ /** `build.outDir` is `root` or a folder that contains it. */
236
+ CliConfigOutDirDeletesRoot = 3115,
237
+ /** The project is missing a dev dependency the CLI runs, like `typescript` or `@cloudflare/vite-plugin`. */
238
+ CliDependencyMissing = 3116,
239
+ /** `build.outDir` already has other files in it. */
240
+ CliBuildOutDirNotEmpty = 3117,
241
+ /** One CLI step found two or more problems. Each one is in the error's `errors`. */
242
+ CliProblems = 3118,
243
+ /** `seedcord codegen --check` found the committed augmentations out of date. */
244
+ CliCodegenOutOfDate = 3119,
245
+ /** A file or folder in the project has a `#` in its path. */
246
+ CliPathHasHash = 3120,
247
+ /** An edge bot's tsconfig is missing the `workerd` condition. */
248
+ CliEdgeWithoutWorkerdCondition = 3121,
249
+ /** A bot with no `cloudflare.config.ts` sets the `workerd` condition in its tsconfig. */
250
+ CliWorkerdConditionWithoutCloudflareConfig = 3122,
251
+ /** TypeScript could not read the project's tsconfig, or Cloudflare's config loader could not read `cloudflare.config.ts`. */
252
+ CliConfigFileUnreadable = 3123,
253
+ /** The CLI could not start the TypeScript compiler. */
254
+ CliTypescriptNotStarted = 3124,
255
+ /** A config file sets a field this bot can't set, like `entrypoint` in an edge bot's `cloudflare.config.ts`. */
256
+ CliConfigFieldUnused = 3125,
257
+ /** An edge bot's `compatibilityDate` is older than Cloudflare's Node compat default, and no flag turns it on. */
258
+ CliEdgeCompatDateTooOld = 3126,
259
+ /** An edge bot sets `no_nodejs_compat`. */
260
+ CliEdgeNodeCompatOff = 3127,
261
+ /** The build could not start the edge worker in workerd. */
262
+ CliEdgeBootFailed = 3128,
263
+ /** An edge bot's `root` holds its seedcord config. */
264
+ CliEdgeRootHoldsConfig = 3129,
265
+ /** An edge build found commands in code that have no deployed id on Discord. */
266
+ CliEdgeCommandsNotDeployed = 3130,
267
+ /** Something called the dev runtime before `start()` finished or after `stop()`. This is a bug in seedcord. */
268
+ CliDevRuntimeNotRunning = 3131,
269
+ /** `seedcord commands deploy` ran on a bot whose `commands.path` is `null`. */
270
+ CliDeployNoCommandsFolder = 3132,
271
+ /** `seedcord commands deploy` ran without `--yes` where it cannot ask first. */
272
+ CliDeployNeedsYes = 3133,
273
+ /** A class carrying `@RegisterCommand` builds a component that is not a command or a context menu. */
274
+ CliCommandNotACommand = 3134,
275
+ /** `seedcord commands clean` or `purge` could not delete some of the commands it picked. */
276
+ CliCommandsNotDeleted = 3135,
277
+ /** The CLI ran on Bun for an edge bot. */
278
+ CliEdgeOnBun = 3136,
279
+ /** An edge bot's `cloudflare.config.ts` sets no `worker`. */
280
+ CliEdgeNoWorker = 3137,
281
+ /** The running `seedcord` is a different install from the project's own. */
282
+ CliNotProjectInstall = 3138,
283
+ /** Vite's environments leave out the one seedcord runs the bot in. */
284
+ CliViteEnvironmentMissing = 3139,
285
+ /** A folder that `files` in `seedcord.config.ts` lists is missing or is a file. */
286
+ CliListedFolderUnusable = 3140,
287
+ /** Another `seedcord dev` already runs a bot on the same Discord application. */
288
+ CliDevAlreadyRunning = 3141,
289
+ /** The folder that holds the dev session locks belongs to another user. */
290
+ CliDevLockFolderNotOwned = 3142,
291
+ /** A flag answers a question that the earlier answers skip. */
292
+ CreateFlagNotApplicable = 3201,
293
+ /** A flag has a value its question rejects. */
294
+ CreateInvalidAnswer = 3202,
295
+ /** The command line did not parse. */
296
+ CreateBadUsage = 3203,
297
+ /** The target path already has files in it. */
298
+ CreateTargetNotEmpty = 3204,
299
+ /** A command that create-seedcord ran exited non-zero. */
300
+ CreateStepFailed = 3205
301
+ }
302
+ //#endregion
303
+ //#region src/palette.d.ts
304
+ declare const BRAND: {
305
+ readonly flesh: "#f04e36";
306
+ readonly rind: "#6fab49";
307
+ readonly pith: "#f8f6e8";
308
+ };
309
+ declare function setColorLevel(level: ColorSupportLevel): void;
310
+ declare const paint: {
311
+ readonly sky: import("chalk").ChalkInstance;
312
+ readonly path: (path: string) => string;
313
+ readonly iris: import("chalk").ChalkInstance;
314
+ readonly mint: import("chalk").ChalkInstance;
315
+ readonly amber: import("chalk").ChalkInstance;
316
+ readonly coral: import("chalk").ChalkInstance;
317
+ readonly flesh: import("chalk").ChalkInstance;
318
+ readonly rind: import("chalk").ChalkInstance;
319
+ readonly pith: import("chalk").ChalkInstance;
320
+ readonly mute: import("chalk").ChalkInstance;
321
+ readonly check: "✔︎";
322
+ readonly cross: "✘";
323
+ readonly bold: import("chalk").ChalkInstance;
324
+ readonly italic: import("chalk").ChalkInstance;
325
+ readonly underline: import("chalk").ChalkInstance;
326
+ };
327
+ declare const WORDMARK: string;
328
+ //#endregion
329
+ //#region src/ErrorMessages.d.ts
330
+ interface VitePluginPlace {
331
+ hook?: string | undefined;
332
+ loading?: {
333
+ kind: 'file';
334
+ path: string;
335
+ } | {
336
+ kind: 'virtual';
337
+ id: string;
338
+ } | undefined;
339
+ }
340
+ declare const listedFolderProblems: {
341
+ missing: string;
342
+ file: string;
343
+ outsideProject: string;
344
+ };
345
+ /** @internal */
346
+ declare const messages: {
347
+ 1001: (count: number) => string;
348
+ 1002: (key: string) => string;
349
+ 1003: (key: string, name: string, where: string) => string;
350
+ 1004: (key: string, name: string, where: string, reason: string, fix: string) => string;
351
+ 1005: (envKey: string) => string;
352
+ 1006: (name: string) => string;
353
+ 1007: (name: string, expected: string, why?: string) => string;
354
+ 1008: (commands: readonly string[]) => string;
355
+ 1009: (runtime: string, required: string, running: string) => string;
356
+ 1010: (key: string) => string;
357
+ 1011: (port: number, setting: string, configFile?: string) => string;
358
+ 1101: (action: "add" | "remove", startup: "running" | "finished") => string;
359
+ 1102: (phase: unknown) => string;
360
+ 1103: (phase: string, failures: number) => string;
361
+ 1104: (taskName: string, timeout: number) => string;
362
+ 1105: () => string;
363
+ 1106: (setting: string, value: number) => string;
364
+ 1201: () => string;
365
+ 1202: () => string;
366
+ 1203: (key: string) => string;
367
+ 1204: (guildId?: string) => string;
368
+ 1205: (controllerName: string, pathKind: string) => string;
369
+ 1206: (file: string, reason: string) => string;
370
+ 1229: (plugin: string, place: VitePluginPlace, configFile: string, reason: string) => string;
371
+ 1207: (path: string, reason: string) => string;
372
+ 1219: (path: string, root: string) => string;
373
+ 1223: (dir: string) => string;
374
+ 1225: (dir: string, root: string) => string;
375
+ 1230: (dir: string) => string;
376
+ 1231: (dir: string) => string;
377
+ 1215: (head: string, key: string) => string;
378
+ 1217: (key: string, reason: string) => string;
379
+ 1218: (plugin: string) => string;
380
+ 1220: (plugin: string, axis: string, declared: string, host: string) => string;
381
+ 1216: (key: string) => string;
382
+ 1208: (key: string) => string;
383
+ 1209: () => string;
384
+ 1222: () => string;
385
+ 1221: () => string;
386
+ 1210: (accessor: string, key: string) => string;
387
+ 1211: () => string;
388
+ 1212: (event: string) => string;
389
+ 1213: (commandName: string) => string;
390
+ 1214: (guildId: string, reason: string, status?: number) => string;
391
+ 1224: (reason: string, status?: number) => string;
392
+ 1226: (className: string) => string;
393
+ 1227: (what: string, reason: string, fix?: string) => string;
394
+ 1228: (kind: string, name: string, sources?: readonly string[], note?: string) => string;
395
+ 1301: (commandName: string, existingCall: string, requestedCall: string) => string;
396
+ 1302: (className: string) => string;
397
+ 1303: (className: string) => string;
398
+ 1304: (className: string, priority: string) => string;
399
+ 1305: (className: string) => string;
400
+ 1306: (className: string, key: string) => string;
401
+ 1501: (method: string, reason: string, alternative: string, routeId: string) => string;
402
+ 1502: (componentClass: string, index: number, detail: string, routeId: string) => string;
403
+ 1503: (method: string, targetId: string, routeId: string) => string;
404
+ 1504: (method: string, routeId: string) => string;
405
+ 1505: (method: string, routeId: string) => string;
406
+ 1601: (prefix: string) => string;
407
+ 1602: (field: string) => string;
408
+ 1603: (field: string, method: string) => string;
409
+ 1604: (field: string, min: number, max: number) => string;
410
+ 1605: (field: string, expected: string, value: string) => string;
411
+ 1606: (prefix: string, length: number) => string;
412
+ 1607: (className: string) => string;
413
+ 1608: (handler: string, kind: string, value: string) => string;
414
+ 1609: (handler: string, read: string) => string;
415
+ 1610: () => string;
416
+ 1611: (customId: string) => string;
417
+ 1612: (customId: string, kind: string, getter?: string) => string;
418
+ 1613: (customId: string) => string;
419
+ 1614: (customId: string, picked: string, allowed: readonly string[]) => string;
420
+ 1615: (prefix: string) => string;
421
+ 1616: (detail: string) => string;
422
+ 1617: (key: string) => string;
423
+ 1701: (input: string) => string;
424
+ 1801: (perPage: number) => string;
425
+ 1802: (count: number, max: number) => string;
426
+ 1803: (key: string) => string;
427
+ 1901: (value: string) => string;
428
+ 1902: (value: number) => string;
429
+ 1951: (option: string, expected: string, value: number) => string;
430
+ 1952: (value: string) => string;
431
+ 1971: (filename: string, logsFolder: string) => string;
432
+ 2001: (pluginName: string, reason: string) => string;
433
+ 2002: (count: number) => string;
434
+ 2003: (decorator: string, className: string) => string;
435
+ 2004: (pluginName: string) => string;
436
+ 2005: (service: string, target?: string) => string;
437
+ 2006: (service: string) => string;
438
+ 2101: (modelName: string, className: string) => string;
439
+ 2102: (className: string) => string;
440
+ 2201: (className: string) => string;
441
+ 2202: (steps: number) => string;
442
+ 2203: (direction: unknown) => string;
443
+ 2204: (filePath: string) => string;
444
+ 2205: (message: string) => string;
445
+ 2206: (databaseName: string) => string;
446
+ 3001: () => string;
447
+ 3101: () => string;
448
+ 3102: (baseDir: string, candidates: readonly string[]) => string;
449
+ 3112: (field: string, expected: string) => string;
450
+ 3103: (path: string, field: string) => string;
451
+ 3104: (instancePath: string) => string;
452
+ 3105: (instancePath: string, reason: string) => string;
453
+ 3106: (configDir: string, configured?: string) => string;
454
+ 3116: (packages: readonly string[], projectDir: string, why: string) => string;
455
+ 3107: (diagnostics: string) => string;
456
+ 3114: (reason: string) => string;
457
+ 3115: (outDir: string, root: string) => string;
458
+ 3117: (outDir: string) => string;
459
+ 3118: (count: number) => string;
460
+ 3130: (lines: readonly string[]) => string;
461
+ 3131: (method: string) => string;
462
+ 3132: (instance: string) => string;
463
+ 3133: () => string;
464
+ 3108: (flags: readonly string[], note?: string) => string;
465
+ 3113: (name: string, file: string, reason: string) => string;
466
+ 3134: (name: string, file: string) => string;
467
+ 3135: () => string;
468
+ 3136: () => string;
469
+ 3137: (cloudflareConfig: string) => string;
470
+ 3138: (cliDir: string, projectInstall: string) => string;
471
+ 3139: (name: string, created: readonly string[]) => string;
472
+ 3140: (folder: string, problem: keyof typeof listedFolderProblems) => string;
473
+ 3141: (configDir: string, pid: number, startedAt: string, lockFile: string) => string;
474
+ 3142: (folder: string) => string;
475
+ 3119: (outputPath: string) => string;
476
+ 3121: (cloudflareConfig: string, tsconfig: string) => string;
477
+ 3122: (tsconfig: string, configDir: string) => string;
478
+ 3123: (tool: string, file: string, output: string) => string;
479
+ 3125: (field: string, file: string, why: string) => string;
480
+ 3126: (cloudflareConfig: string, date: string, firstDate: string) => string;
481
+ 3127: (cloudflareConfig: string) => string;
482
+ 3128: (reason: string) => string;
483
+ 3129: (configFile: string, root: string) => string;
484
+ 3124: (tsc: string, reason: string) => string;
485
+ 3120: (path: string) => string;
486
+ 3109: (seconds: number) => string;
487
+ 3110: (url: string) => string;
488
+ 3111: (url: string, seconds: number) => string;
489
+ 3201: (flag: string) => string;
490
+ 3202: (flag: string, reason: string) => string;
491
+ 3203: (reason: string) => string;
492
+ 3204: (target: string) => string;
493
+ 3205: (command: string, reason: string) => string;
494
+ };
495
+ /** @internal */
496
+ type SeedcordErrorArguments<Code extends SeedcordErrorCode> = Parameters<(typeof messages)[Code]>;
497
+ //#endregion
498
+ //#region src/SeedcordError.d.ts
499
+ /**
500
+ * String literal type for Seedcord error identifiers.
501
+ *
502
+ * @internal
503
+ */
504
+ type SeedcordErrorIdentifier = keyof typeof SeedcordErrorCode;
505
+ /**
506
+ * Options for Seedcord errors.
507
+ *
508
+ * @internal
509
+ */
510
+ interface SeedcordErrorOptions extends ErrorOptions {}
511
+ type SeedcordErrorCtorRest<Code extends SeedcordErrorCode> = SeedcordErrorArguments<Code> extends [] ? [options?: SeedcordErrorOptions] : [args: SeedcordErrorArguments<Code>, options?: SeedcordErrorOptions];
512
+ /**
513
+ * String literal type for Seedcord error class names. Names the `type` argument of
514
+ * {@link isSeedcordError}.
515
+ */
516
+ type SeedcordErrorTypeString = `Seedcord${'Error' | 'TypeError' | 'RangeError' | 'AggregateError'}`;
517
+ declare const kIdentifier: unique symbol;
518
+ interface BaseSeedcordError {
519
+ readonly code: SeedcordErrorCode;
520
+ readonly [kIdentifier]: SeedcordErrorIdentifier;
521
+ readonly type: SeedcordErrorTypeString;
522
+ }
523
+ declare class SeedcordError<Code extends SeedcordErrorCode = SeedcordErrorCode> extends Error implements BaseSeedcordError {
524
+ readonly code: Code;
525
+ readonly [kIdentifier]: SeedcordErrorIdentifier;
526
+ readonly type = "SeedcordError";
527
+ constructor(code: Code, ...rest: SeedcordErrorCtorRest<Code>);
528
+ }
529
+ declare class SeedcordTypeError<Code extends SeedcordErrorCode = SeedcordErrorCode> extends TypeError implements BaseSeedcordError {
530
+ readonly code: Code;
531
+ readonly [kIdentifier]: SeedcordErrorIdentifier;
532
+ readonly type = "SeedcordTypeError";
533
+ constructor(code: Code, ...rest: SeedcordErrorCtorRest<Code>);
534
+ }
535
+ declare class SeedcordRangeError<Code extends SeedcordErrorCode = SeedcordErrorCode> extends RangeError implements BaseSeedcordError {
536
+ readonly code: Code;
537
+ readonly [kIdentifier]: SeedcordErrorIdentifier;
538
+ readonly type = "SeedcordRangeError";
539
+ constructor(code: Code, ...rest: SeedcordErrorCtorRest<Code>);
540
+ }
541
+ declare class SeedcordAggregateError<Code extends SeedcordErrorCode = SeedcordErrorCode> extends AggregateError implements BaseSeedcordError {
542
+ readonly code: Code;
543
+ readonly [kIdentifier]: SeedcordErrorIdentifier;
544
+ readonly type = "SeedcordAggregateError";
545
+ constructor(code: Code, errors: readonly unknown[], ...rest: SeedcordErrorCtorRest<Code>);
546
+ }
547
+ /**
548
+ * Variant type for Seedcord error classes.
549
+ *
550
+ * @internal
551
+ */
552
+ type SeedcordErrorVariant<Type extends SeedcordErrorTypeString, Code extends SeedcordErrorCode> = Type extends 'SeedcordError' ? SeedcordError<Code> : Type extends 'SeedcordTypeError' ? SeedcordTypeError<Code> : Type extends 'SeedcordRangeError' ? SeedcordRangeError<Code> : SeedcordAggregateError<Code>;
553
+ /**
554
+ * Union type of all Seedcord error variants for a specific error code.
555
+ *
556
+ * @internal
557
+ */
558
+ type AnySeedcordErrorForCode<Code extends SeedcordErrorCode> = { [Variant in SeedcordErrorTypeString]: SeedcordErrorVariant<Variant, Code>; }[SeedcordErrorTypeString];
559
+ /**
560
+ * Union type of all Seedcord errors filtered by error class.
561
+ *
562
+ * @internal
563
+ */
564
+ type ErrorTypeFilter<Type extends SeedcordErrorTypeString | undefined> = Type extends SeedcordErrorTypeString ? { [Code in SeedcordErrorCode]: SeedcordErrorVariant<Type, Code>; }[SeedcordErrorCode] : AnySeedcordErrorForCode<SeedcordErrorCode>;
565
+ /**
566
+ * Union type of all Seedcord errors filtered by error class and error code.
567
+ *
568
+ * @internal
569
+ */
570
+ type ErrorCodeFilter<Type extends SeedcordErrorTypeString | undefined, Code extends SeedcordErrorCode | undefined> = Code extends SeedcordErrorCode ? Type extends SeedcordErrorTypeString ? SeedcordErrorVariant<Type, Code> : AnySeedcordErrorForCode<Code> : ErrorTypeFilter<Type>;
571
+ /**
572
+ * Determines whether an unknown value is a Seedcord error, with optional narrowing by class and error code.
573
+ *
574
+ * @param error - The value to inspect.
575
+ * @param type - Optional error class discriminator.
576
+ * @param code - Optional {@link SeedcordErrorCode} discriminator to narrow by code.
577
+ * @typeParam Type - What kind of {@link SeedcordErrorTypeString} to filter by.
578
+ * @typeParam Code - The specific {@link SeedcordErrorCode} to filter by.
579
+ */
580
+ declare function isSeedcordError<Type extends SeedcordErrorTypeString | undefined, Code extends SeedcordErrorCode | undefined>(error: unknown, type?: Type, code?: Code): error is ErrorCodeFilter<Type, Code>;
581
+ //#endregion
582
+ export { SeedcordTypeError as a, VitePluginPlace as c, paint as d, setColorLevel as f, SeedcordRangeError as i, BRAND as l, SeedcordError as n, isSeedcordError as o, SeedcordErrorCode as p, SeedcordErrorTypeString as r, SeedcordErrorArguments as s, SeedcordAggregateError as t, WORDMARK as u };
583
+ //# sourceMappingURL=SeedcordError-Cce9qKW3.d.mts.map