Repository navigation
[Fix] Issue-1 Improve error propagation and stop silently swallowing errors - #1103
Closed
devin-ai-integration[bot] wants to merge 1 commit into
Closed
devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
…errors Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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:
|
|
| function errorHandler(err, req, res, next) { | ||
| const statusCode = resolveStatusCode(err); | ||
|
|
||
| console.error( |
This branch was successfully deployed
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.




Description
Fixes #1104
Audit of error handling across
packages/appandpackages/ui, fixing paths where failures were swallowed or reported as success.Backend:
middlewares/errorHandler.js— until nownext(err)from controllers fell through to Express' default HTML error page. Adds a JSON error boundary matching the existing{ statusCode, error, message }envelope, maps Mongoose validation/cast, body-parse and CORS errors to 4xx, and hides internal messages for 5xx. Also adds a JSON 404 handler, plusmongoose.connection.on("error")andunhandledRejection/uncaughtExceptionlogging inserver.js.sendEmailused tocatchand only log, so callers saw a successful send. It now throws a502-tagged error (original preserved incause). Signup responds201 { emailSent: false, message: VERIFICATION_EMAIL_FAILED }(the account is already created), and the operator reply endpoint responds502(the reply is already persisted), instead of both claiming delivery.mfa.updateMfaUserno longer converts encryption/persistence failures intoreturn false(indistinguishable from "user not found");mfaLoginthrows when the stored secret is missing instead of treating server-side corruption as a wrong token, and only swallows theauthenticator.verifyfailure of a malformed client token.webLogoSearch: the Clearbit lookup resolvednullon request/parse errors, so an outage looked like "no such company"; it now rejects, andgrabCompanyLogosreportserroron its result.catalogrethrows that into its existing 502 path.logo: the usage-count increment is awaited instead of fire-and-forget, so a failed increment no longer returns 200 with unmetered usage. Same for the session activity refresh inmiddlewares/auth.js— still non-fatal, but awaited so the rejection is logged during the request instead of after it (this dangling promise was also what madejestexit non-zero locally; the 9 suites that stubbedvalidateSessionwith a bare{ userId }now stubtouchSessiontoo).refreshUsageCountscript rejection and the user-data export path (which previously logged afternext(err)).Frontend:
getErrorMessagehelper inutils/Helpers.js;UserContext/OperatorContextpassed the raw Error object totoast.error(err)(rendering as an object), and now show the API message.OperatorDashboardmessages/requests/logos fetches only logged to the console — failures were invisible in the UI; they now toast.processWebImagerestores fallback dimensions when SVG parsing fails.What type of PR is this? (Check all applicable)
Screenshots (if applicable)
N/A — no visual changes beyond error toasts.
Checklist
Link to Devin session: https://app.devin.ai/sessions/8f35695ae1024fc0af8b0ee6bd66966b
Requested by: @sunnykgupta