Skip to content

Improve error handling: propagate and surface swallowed errors - #12

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1784700382-error-handling
Open

Improve error handling: propagate and surface swallowed errors#12
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1784700382-error-handling

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Jul 22, 2026

Copy link
Copy Markdown

Summary

Several errors were being silently swallowed or left unhandled across the backend and frontend, causing failures to either crash the server (unhandled promise rejections) or fail silently in the UI with no feedback. This PR propagates those errors and surfaces them to the user/logs.

Backend (backend/index.js)

  • submit and submissions route handlers only wrapped part of their logic (or nothing) in try/catch, so getSigner/axios/estimateGas failures became unhandled rejections with no HTTP response. Now the full handler bodies are wrapped and return 500 { success: false, error }. The error field now sends e.message instead of the raw error object (which didn't serialize and leaked internals).
  • urls_from_prompt swallowed all errors and logged e.response.data (itself throwing when e.response is undefined), then returned undefined while the ws handler still replied success: true. Removed the internal swallow so the error propagates to the caller.
  • The websocket message handler had no try/catch and always sent success: true. It now catches parse/generation failures and replies { success: false, error }:
try {
    const urls = await urls_from_prompt(prompt);
    ws.send(JSON.stringify({ type: "result", success: true, urls }));
} catch (e) {
    ws.send(JSON.stringify({ type: "result", success: false, error: "Failed to generate images" }));
}
  • Startup downloadImage(...) / urls_from_prompt(...) calls now have .catch so a boot-time failure logs instead of an unhandled rejection.

Frontend

  • helpers/web3.ts: the .send(...) callbacks did if (err) reject(err); resolve(data)resolve ran even after a reject. Changed to else resolve(data) in callMakeTask, callSubmit, callAssignWinner.
  • SubmitSection.tsx: two empty .catch((e) => {}) blocks swallowed proposal failures; now log + alert. JSON.parse of the ws message is wrapped in try/catch, and a success: false result now alerts and clears the loading state.
  • WinnerSection.tsx: .catch() with no handler re-threw (unhandled rejection); now logs + alerts.
  • Requesting.tsx: callMakeTask(...) and getBalance(...) had no .catch; added handlers.
  • SubmissionProvider.tsx and App.tsx bounty-refresh chains / connectWallet calls had no .catch; added logging. The empty // handle "add" error MetaMask catch now logs.

No behavior change on the success path; typecheck (tsc --noEmit) passes and no new eslint errors.

Link to Devin session: https://app.devin.ai/sessions/00d53b270c8c4bf4869aa206dbf9237b
Requested by: @walnutwaldo


Devin Review

Status Commit
⚪ Not started

Run Devin Review

Open in Devin Review (Staging)

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@walnutwaldo walnutwaldo self-assigned this Jul 22, 2026
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@github-actions

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 824aae3):

https://decentralized-dall-e--pr12-devin-1784700382-err-7t13tiwu.web.app

(expires Wed, 29 Jul 2026 06:09:26 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: 9f3ca659ce42113c1a9d85a3ba19a54f05478557

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