@enactprotocol/cli 2.1.29 → 2.1.31
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/dist/commands/init/index.d.ts.map +1 -1
- package/dist/commands/init/index.js +9 -0
- package/dist/commands/init/index.js.map +1 -1
- package/dist/commands/run/index.d.ts.map +1 -1
- package/dist/commands/run/index.js +10 -0
- package/dist/commands/run/index.js.map +1 -1
- package/dist/commands/search/index.d.ts.map +1 -1
- package/dist/commands/search/index.js +5 -4
- package/dist/commands/search/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/utils/errors.d.ts +7 -1
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +19 -6
- package/dist/utils/errors.js.map +1 -1
- package/package.json +5 -5
- package/src/commands/init/index.ts +10 -0
- package/src/commands/run/index.ts +12 -0
- package/src/commands/search/index.ts +5 -4
- package/src/index.ts +1 -1
- package/src/utils/errors.ts +21 -8
- package/tsconfig.tsbuildinfo +1 -1
package/src/utils/errors.ts
CHANGED
|
@@ -105,8 +105,11 @@ export class ValidationError extends CliError {
|
|
|
105
105
|
* Authentication error
|
|
106
106
|
*/
|
|
107
107
|
export class AuthError extends CliError {
|
|
108
|
-
constructor(message: string) {
|
|
109
|
-
|
|
108
|
+
constructor(message: string, options?: { expired?: boolean }) {
|
|
109
|
+
const suggestion = options?.expired
|
|
110
|
+
? "Your session may have expired. Run 'enact auth login' to log in again."
|
|
111
|
+
: "Run 'enact auth login' to authenticate.";
|
|
112
|
+
super(message, EXIT_AUTH_ERROR, suggestion);
|
|
110
113
|
this.name = "AuthError";
|
|
111
114
|
}
|
|
112
115
|
}
|
|
@@ -319,12 +322,13 @@ export function categorizeError(err: unknown): CliError {
|
|
|
319
322
|
return new TimeoutError("Operation", 30000);
|
|
320
323
|
}
|
|
321
324
|
|
|
322
|
-
// Authentication
|
|
323
|
-
if (
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
325
|
+
// Authentication - check for 401 which usually means expired session
|
|
326
|
+
if (message.includes("401") || message.includes("unauthorized")) {
|
|
327
|
+
return new AuthError("Authentication failed", { expired: true });
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// Other auth errors
|
|
331
|
+
if (message.includes("authentication") || message.includes("not authenticated")) {
|
|
328
332
|
return new AuthError(err.message);
|
|
329
333
|
}
|
|
330
334
|
|
|
@@ -360,6 +364,15 @@ export const ErrorMessages = {
|
|
|
360
364
|
],
|
|
361
365
|
}),
|
|
362
366
|
|
|
367
|
+
sessionExpired: () => ({
|
|
368
|
+
message: "Authentication failed",
|
|
369
|
+
suggestions: [
|
|
370
|
+
"Your session may have expired",
|
|
371
|
+
`Log in again: ${colors.command("enact auth login")}`,
|
|
372
|
+
`Check status: ${colors.command("enact auth status")}`,
|
|
373
|
+
],
|
|
374
|
+
}),
|
|
375
|
+
|
|
363
376
|
manifestNotFound: (dir: string) => ({
|
|
364
377
|
message: `No manifest found in ${dir}`,
|
|
365
378
|
suggestions: [
|