Skip to content

Commit ea1757a

Browse files
committed
Format
1 parent 7cea7fb commit ea1757a

File tree

4 files changed

+43
-21
lines changed

4 files changed

+43
-21
lines changed

src/commands/login.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,9 @@ export const loginCommand = new Command('login')
138138
console.error(chalk.yellow(` Retry after: ${error.retryAfterSeconds}s`))
139139
}
140140
console.error(
141-
chalk.gray(' You have made too many login attempts. Please wait before trying again.')
141+
chalk.gray(
142+
' You have made too many login attempts. Please wait before trying again.'
143+
)
142144
)
143145
} else {
144146
console.error(chalk.red('✖ Permission denied (403)'))
@@ -158,7 +160,11 @@ export const loginCommand = new Command('login')
158160
}
159161

160162
// Catch 403/rate-limit in generic error strings (e.g. from SDK internals)
161-
if (errorMessage.includes('403') || errorMessage.toLowerCase().includes('permissiondenied') || errorMessage.toLowerCase().includes('rate limit')) {
163+
if (
164+
errorMessage.includes('403') ||
165+
errorMessage.toLowerCase().includes('permissiondenied') ||
166+
errorMessage.toLowerCase().includes('rate limit')
167+
) {
162168
if (options.json) {
163169
console.log(
164170
JSON.stringify({

src/commands/projects.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ import { isValidPrivateKey } from '../lib/wallet.js'
1717
* Returns true if the error was handled; false otherwise.
1818
*/
1919
function handleApiErrorOutput(error: unknown, json: boolean): boolean {
20-
if (isApiError(error) && (error.isRateLimited || error.isPermissionDenied || error.isUnauthorized)) {
20+
if (
21+
isApiError(error) &&
22+
(error.isRateLimited || error.isPermissionDenied || error.isUnauthorized)
23+
) {
2124
if (json) {
2225
console.log(
2326
JSON.stringify({
@@ -38,7 +41,9 @@ function handleApiErrorOutput(error: unknown, json: boolean): boolean {
3841
if (error.retryAfterSeconds !== null) {
3942
console.error(chalk.yellow(` Retry after: ${error.retryAfterSeconds}s`))
4043
}
41-
console.error(chalk.gray(' You have made too many requests. Please wait before trying again.'))
44+
console.error(
45+
chalk.gray(' You have made too many requests. Please wait before trying again.')
46+
)
4247
} else if (error.isPermissionDenied) {
4348
console.error(chalk.red('✖ Permission denied (403)'))
4449
console.error(chalk.gray(' This can happen when:'))
@@ -50,7 +55,9 @@ function handleApiErrorOutput(error: unknown, json: boolean): boolean {
5055
}
5156
} else {
5257
console.error(chalk.red('✖ Unauthorized (401)'))
53-
console.error(chalk.gray(' Your JWT token may have expired. Re-run: sequence-builder login'))
58+
console.error(
59+
chalk.gray(' Your JWT token may have expired. Re-run: sequence-builder login')
60+
)
5461
}
5562
if (error.errorBody) {
5663
console.error(chalk.gray(` Server response: ${error.errorBody}`))

src/commands/transfer.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -327,21 +327,19 @@ export const transferCommand = new Command('transfer')
327327
if (error.isRateLimited) {
328328
console.error(chalk.red('✖ Rate limited by the API'))
329329
if (error.retryAfterSeconds !== null) {
330-
console.error(
331-
chalk.yellow(` Retry after: ${error.retryAfterSeconds}s`)
332-
)
330+
console.error(chalk.yellow(` Retry after: ${error.retryAfterSeconds}s`))
333331
}
334-
console.error(chalk.gray(' You have made too many requests. Please wait before trying again.'))
332+
console.error(
333+
chalk.gray(' You have made too many requests. Please wait before trying again.')
334+
)
335335
} else {
336336
console.error(chalk.red('✖ Permission denied (403)'))
337337
console.error(chalk.gray(' This can happen when:'))
338338
console.error(chalk.gray(' - Your session or ETHAuth proof has expired'))
339339
console.error(chalk.gray(' - You have exceeded the signing rate limit'))
340340
console.error(chalk.gray(' - The access key is invalid or revoked'))
341341
if (error.retryAfterSeconds !== null) {
342-
console.error(
343-
chalk.yellow(` Retry after: ${error.retryAfterSeconds}s`)
344-
)
342+
console.error(chalk.yellow(` Retry after: ${error.retryAfterSeconds}s`))
345343
}
346344
}
347345
if (error.errorBody) {
@@ -375,7 +373,11 @@ export const transferCommand = new Command('transfer')
375373
}
376374

377375
// Check for 403/rate-limit in generic error messages (e.g. from Sequence SDK)
378-
if (errorMessage.includes('403') || errorMessage.toLowerCase().includes('permissiondenied') || errorMessage.toLowerCase().includes('rate limit')) {
376+
if (
377+
errorMessage.includes('403') ||
378+
errorMessage.toLowerCase().includes('permissiondenied') ||
379+
errorMessage.toLowerCase().includes('rate limit')
380+
) {
379381
if (json) {
380382
console.log(
381383
JSON.stringify({
@@ -398,7 +400,13 @@ export const transferCommand = new Command('transfer')
398400
}
399401

400402
if (json) {
401-
console.log(JSON.stringify({ error: errorMessage, code: EXIT_CODES.GENERAL_ERROR, timing: { failedStep: currentStep, failedStepMs, totalElapsedMs } }))
403+
console.log(
404+
JSON.stringify({
405+
error: errorMessage,
406+
code: EXIT_CODES.GENERAL_ERROR,
407+
timing: { failedStep: currentStep, failedStepMs, totalElapsedMs },
408+
})
409+
)
402410
} else {
403411
console.error(chalk.red('✖ Transfer failed:'), errorMessage)
404412
}

src/lib/api.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,14 @@ export class ApiError extends Error {
5858
public readonly isUnauthorized: boolean
5959

6060
constructor(statusCode: number, errorBody: string, retryAfter: number | null) {
61-
const label = statusCode === 429
62-
? 'Rate Limited'
63-
: statusCode === 403
64-
? 'Permission Denied'
65-
: statusCode === 401
66-
? 'Unauthorized'
67-
: `API Error`
61+
const label =
62+
statusCode === 429
63+
? 'Rate Limited'
64+
: statusCode === 403
65+
? 'Permission Denied'
66+
: statusCode === 401
67+
? 'Unauthorized'
68+
: `API Error`
6869

6970
let detail = `${label} (${statusCode})`
7071
if (errorBody) {

0 commit comments

Comments
 (0)