Propagate CLI errors instead of silently swallowing them - #3
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
Propagate CLI errors instead of silently swallowing them#3devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
Description of Changes
Every command previously ended by logging a failure and returning normally, so
next-quickreported a half-finished project as success and exited0. Failures are now propagated to a single place that reports them and sets a non-zero exit code.Root causes fixed:
Plugin.installwas typed=> void, butkindeandmongooseareasync.plugins.kinde.install({})/plugins.mongoose.install({})returned a floating promise, so the surroundingtry/catchcould never see a failure and the command returned before setup finished.installis now=> void | Promise<void>and all call sitesawaitit (also ininstallPlugins, which usedforEach+ per-plugincatchthat continued installing after a failure)..then().catch(console.error)ininitanddeployturned any failure into a log line. Both are now plainawaitinside the command action, and a missing selection throws instead ofreturn-ing.writeToEnvlogged and returned when.env.localwas missing or unwritable (the Mongo connection string was silently dropped);applyPackageJsonAdditionslogged a read/write failure and then printedpackage.json has been updated;updateEslintConfigreturned early leaving Prettier half-configured. These now throw with the failing path in the message.execSync.npm install,git init, andnpx huskyfailures surfaced as bare shell noise; they're wrapped with the command that failed.githelpers conflated "not configured" with "git broke".hasRemote()returnedfalseon any error, printing the "add a remote" instructions even when git itself failed.hasUnpushedChanges()used the exit code ofgit diff --quietas a signal, so an unrelated git failure read as "you have uncommitted changes"; it now inspectsgit status --porcelain --untracked-files=nooutput and throws on failure.Done?answer and re-prompted forever until the env file happened to be complete; answering "no" now exits with instructions.plugins/config.jsonwas filtered out of the registry, soplugins.kinde.installthrewTypeError: undefined.requirePlugin()gives an actionable message.New
utils/errors.ts:src/index.tswraps eachprogram.command(...).action(...)inrunCommandand registersunhandledRejection/uncaughtExceptionhandlers as a backstop. Remainingconsole.errorcalls were switched tolog(..., LogLevel.error)for consistent formatting.Also
checkIfAnyDirectoryExistsusesreaddirSync(cwd, { withFileTypes: true })instead of astatSyncper entry, which threw on broken symlinks in the cwd.Verified with
npx tsc --noEmit,npm run build,eslint, and by running the built CLI: a malformed.nextquickrcnow prints✖ Error: Failed to read /tmp/nqtest/.nextquickrc: ...and exits1(previously an unhandled throw). No behavior change on the happy path.Related Issues
None
Link to Devin session: https://app.devin.ai/sessions/930de6c8667a42399318e34d90a17035
Requested by: @lox-bot