Skip to content

APR-200: Surface scan errors via PackageResult.error field#55

Open
JacobSampson wants to merge 1 commit into
mainfrom
APR-200/improve-scan-error-handling
Open

APR-200: Surface scan errors via PackageResult.error field#55
JacobSampson wants to merge 1 commit into
mainfrom
APR-200/improve-scan-error-handling

Conversation

@JacobSampson

Copy link
Copy Markdown
Contributor

Summary

  • Adds error?: string to the PackageResult interface so callers can distinguish a failed scan from a successful scan with zero issues
  • Updates the per-package catch block in runner.ts to set error: String(err) on the result
  • Updates formatSummary in the CLI to display the error when present

Changes

  • packages/devtools/src/desloppify/types.ts: added error?: string to PackageResult
  • packages/devtools/src/desloppify/runner.ts: catch block now populates error field (line 269)
  • packages/devtools/src/commands/desloppify.ts: formatSummary renders Error: ... for failed packages
  • packages/devtools/src/__tests__/runner.test.ts: two new tests using a mocked execSync — one for the error path, one confirming the happy-path result has no error field

Test Plan

  • runDesloppifyScan sets result.packages[n].error when execSync throws
  • runDesloppifyScan does not set error on a successful scan with zero issues
  • All 18 unit tests pass (pnpm test)
  • TypeScript type check passes (pnpm typecheck)
  • Lint passes with 0 errors (pnpm lint)

Closes: APR-200

🤖 Generated with Claude Code

When a per-package desloppify scan fails, the catch block previously
logged via console.error and pushed an empty result with no way for
callers to distinguish a failure from a genuine zero-issue scan.

Adds optional `error?: string` to PackageResult, sets it in the catch
block, and surfaces it in the CLI summary output.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant