Skip to content

Ingest: catch exceptions in --dev#236

Merged
janezd merged 2 commits into
biolab:masterfrom
janezd:catch-exceptions-in-dev
Jun 12, 2026
Merged

Ingest: catch exceptions in --dev#236
janezd merged 2 commits into
biolab:masterfrom
janezd:catch-exceptions-in-dev

Conversation

@janezd

@janezd janezd commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

In some cases that I cannot replicate, ingest --dev would get an uncaught exception and kill the app without killing the background server process.

This PR

  • wraps the update into a try-catch block. update is supposed to catch all exceptions, but some (perhaps in other code, like chokidar?) fall through.
  • terminates the server if update workers (and with them the main process) terminate

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the ingest --dev workflow by (1) preventing unexpected exceptions during ingestion updates from crashing the process and (2) ensuring the background Next.js server is terminated when the ingest process terminates unexpectedly.

Changes:

  • Add a try/catch around updatePaths() inside updateDb() to prevent unhandled exceptions from bubbling out.
  • In scripts/ingest.ts, run Next.js in a detached process and add process-level handlers (uncaughtException, unhandledRejection, signals) to terminate the Next.js process tree.
  • Add the tree-kill dependency (and lockfile entry) for process-tree termination.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 2 comments.

File Description
ingest/index.ts Wraps updatePaths() in try/catch to prevent uncaught exceptions from escaping update runs.
scripts/ingest.ts Adds dev-mode shutdown handlers and uses tree-kill to terminate the spawned Next.js process tree.
package.json Adds tree-kill dependency.
yarn.lock Lockfile update for tree-kill.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ingest/index.ts
Comment thread scripts/ingest.ts
@janezd janezd force-pushed the catch-exceptions-in-dev branch from f17a751 to ff50055 Compare June 12, 2026 07:50
@janezd janezd merged commit da81505 into biolab:master Jun 12, 2026
1 check passed
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.

2 participants