Skip to content

Commit 9582333

Browse files
committed
style: rename catch (err|error) identifiers to catch (e)
Mechanical rename across 44 files in src/, scripts/, and test/ to match the CLAUDE.md catch-binding convention. 79 catch clauses converted; body references renamed including inside template literal interpolations. Property keys and member-access expressions (e.g. logger.error, console.error) are left untouched. tsgo --noEmit -p .config/tsconfig.check.json clean post-sweep.
1 parent 36f35cb commit 9582333

44 files changed

Lines changed: 196 additions & 196 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.config/esbuild.config.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,10 @@ function createPathShorteningPlugin() {
185185
// Write the modified content
186186
// eslint-disable-next-line no-await-in-loop
187187
await fs.writeFile(outputPath, magicString.toString(), 'utf8')
188-
} catch (error) {
188+
} catch (e) {
189189
console.error(
190190
`Failed to shorten paths in ${outputPath}:`,
191-
error.message,
191+
e.message,
192192
)
193193
// Continue without failing the build
194194
}

scripts/build-externals/bundler.mts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,14 +110,14 @@ ${contentWithoutStrict}`
110110
logger.log(` ✓ Bundled ${packageName} (${sizeKB}KB)`)
111111
}
112112
return sizeKB
113-
} catch (error) {
113+
} catch (e) {
114114
if (!quiet) {
115-
logger.log(` ✗ Failed to bundle ${packageName}: ${error.message}`)
115+
logger.log(` ✗ Failed to bundle ${packageName}: ${e.message}`)
116116
}
117117
// Propagate the failure. The orchestrator wraps optional packages in
118118
// try/catch and logs a "Skipping optional package" message; required
119119
// packages bubble up so the build exits non-zero instead of silently
120120
// shipping throw-stubs that only fail later, at consumer runtime.
121-
throw error
121+
throw e
122122
}
123123
}

scripts/check.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ async function main(): Promise<void> {
155155

156156
logger.success('All checks passed')
157157
printFooter()
158-
} catch (error) {
159-
logger.error(`Check failed: ${error.message}`)
158+
} catch (e) {
159+
logger.error(`Check failed: ${e.message}`)
160160
process.exitCode = 1
161161
}
162162
}

scripts/claude.mts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,7 @@ async function runClaude(claudeCmd, prompt, options = {}) {
11401140
modelStrategy.recordAttempt(task, true)
11411141

11421142
return result
1143-
} catch (error) {
1143+
} catch (e) {
11441144
// Record failure for potential escalation
11451145
modelStrategy.recordAttempt(task, false)
11461146

@@ -1152,7 +1152,7 @@ async function runClaude(claudeCmd, prompt, options = {}) {
11521152
return runClaude(claudeCmd, prompt, opts)
11531153
}
11541154

1155-
throw error
1155+
throw e
11561156
}
11571157
}
11581158

@@ -4791,8 +4791,8 @@ Fix all issues by making necessary file changes. Be direct, don't ask questions.
47914791
if (exitCode !== 0) {
47924792
log.warn(`Claude fix exited with code ${exitCode}`)
47934793
}
4794-
} catch (error) {
4795-
log.warn(`Claude fix error: ${error.message}`)
4794+
} catch (e) {
4795+
log.warn(`Claude fix error: ${e.message}`)
47964796
} finally {
47974797
clearInterval(progressInterval)
47984798
log.done('Claude fix attempt completed')
@@ -5111,8 +5111,8 @@ Fix the issue by making necessary file changes. Be direct, don't ask questions.`
51115111
if (exitCode !== 0) {
51125112
log.warn(`Claude fix exited with code ${exitCode}`)
51135113
}
5114-
} catch (error) {
5115-
log.warn(`Claude fix error: ${error.message}`)
5114+
} catch (e) {
5115+
log.warn(`Claude fix error: ${e.message}`)
51165116
} finally {
51175117
clearInterval(progressInterval)
51185118
log.done(`Fix attempt for ${job.name} completed`)
@@ -5313,8 +5313,8 @@ async function runWatchMode(claudeCmd, options = {}) {
53135313
} else {
53145314
log.done('No issues found')
53155315
}
5316-
} catch (error) {
5317-
log.failed(`Error scanning ${project.name}: ${error.message}`)
5316+
} catch (e) {
5317+
log.failed(`Error scanning ${project.name}: ${e.message}`)
53185318
}
53195319
},
53205320
)
@@ -5346,8 +5346,8 @@ async function runWatchMode(claudeCmd, options = {}) {
53465346
},
53475347
)
53485348
}
5349-
} catch (error) {
5350-
log.failed(`Full scan error in ${project.name}: ${error.message}`)
5349+
} catch (e) {
5350+
log.failed(`Full scan error in ${project.name}: ${e.message}`)
53515351
}
53525352
}
53535353
// 30 minutes
@@ -5750,8 +5750,8 @@ async function main(): Promise<void> {
57505750
}
57515751

57525752
process.exitCode = success ? 0 : 1
5753-
} catch (error) {
5754-
log.error(`Operation failed: ${error.message}`)
5753+
} catch (e) {
5754+
log.error(`Operation failed: ${e.message}`)
57555755
process.exitCode = 1
57565756
}
57575757
}

scripts/fix/commonjs-exports.mts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,10 @@ async function processDirectory(
209209
}
210210
}
211211
}
212-
} catch (error) {
212+
} catch (e) {
213213
// Skip directories that don't exist
214-
if (error.code !== 'ENOENT') {
215-
throw error
214+
if (e.code !== 'ENOENT') {
215+
throw e
216216
}
217217
}
218218

@@ -233,8 +233,8 @@ async function fixConstantExports() {
233233
: 'CommonJS Exports (no changes)'
234234
logger.success(title)
235235
}
236-
} catch (error) {
237-
logger.error(`Failed to fix CommonJS exports: ${error.message}`)
236+
} catch (e) {
237+
logger.error(`Failed to fix CommonJS exports: ${e.message}`)
238238
process.exitCode = 1
239239
}
240240
}

scripts/fix/external-imports.mts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,10 +123,10 @@ async function processDirectory(dir, verbose = false) {
123123
}
124124
}
125125
}
126-
} catch (error) {
126+
} catch (e) {
127127
// Skip directories that don't exist.
128-
if (error.code !== 'ENOENT') {
129-
throw error
128+
if (e.code !== 'ENOENT') {
129+
throw e
130130
}
131131
}
132132

@@ -147,8 +147,8 @@ async function fixExternalImports() {
147147
: 'External Imports (no changes)'
148148
logger.success(title)
149149
}
150-
} catch (error) {
151-
logger.error(`Failed to fix external imports: ${error.message}`)
150+
} catch (e) {
151+
logger.error(`Failed to fix external imports: ${e.message}`)
152152
process.exitCode = 1
153153
}
154154
}

scripts/lint.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,8 @@ async function main(): Promise<void> {
457457
logger.success('All lint checks passed!')
458458
}
459459
}
460-
} catch (error) {
461-
logger.error(`Lint runner failed: ${error.message}`)
460+
} catch (e) {
461+
logger.error(`Lint runner failed: ${e.message}`)
462462
process.exitCode = 1
463463
}
464464
}

scripts/test/main.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,12 +506,12 @@ async function main(): Promise<void> {
506506
} else {
507507
logger.success('All tests passed!')
508508
}
509-
} catch (error) {
509+
} catch (e) {
510510
// Ensure spinner is stopped
511511
try {
512512
spinner.stop()
513513
} catch {}
514-
logger.error(`Test runner failed: ${error.message}`)
514+
logger.error(`Test runner failed: ${e.message}`)
515515
process.exitCode = 1
516516
} finally {
517517
// Ensure spinner is stopped

scripts/update.mts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,12 @@ async function main(): Promise<void> {
9191
logger.log('')
9292
}
9393
}
94-
} catch (error) {
94+
} catch (e) {
9595
if (!quiet) {
96-
logger.fail(`Update failed: ${error.message}`)
96+
logger.fail(`Update failed: ${e.message}`)
9797
}
9898
if (verbose) {
99-
logger.error(error)
99+
logger.error(e)
100100
}
101101
process.exitCode = 1
102102
}

scripts/utils/parse-args.mts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ export function parseArgs(
4242
values: result.values,
4343
positionals: result.positionals || [],
4444
}
45-
} catch (error) {
45+
} catch (e) {
4646
// If parsing fails in non-strict mode, return empty values
4747
if (!strict) {
4848
return {
4949
values: {},
5050
positionals: args.filter(arg => !arg.startsWith('-')),
5151
}
5252
}
53-
throw error
53+
throw e
5454
}
5555
}
5656

0 commit comments

Comments
 (0)