Skip to content

chore: enhance error handling and improve PR template#7237

Open
dipanshurdev wants to merge 2 commits intousebruno:mainfrom
dipanshurdev:dev
Open

chore: enhance error handling and improve PR template#7237
dipanshurdev wants to merge 2 commits intousebruno:mainfrom
dipanshurdev:dev

Conversation

@dipanshurdev
Copy link
Copy Markdown

@dipanshurdev dipanshurdev commented Feb 20, 2026

Description

This PR addresses swallowed errors and generic error messages in the collection import/open workflows, making debugging much easier for end users.

Specific Improvements:

  1. Fixed Swallowed Errors in openMultipleCollections: Previously, if opening multiple collections failed, the error was silently ignored (catch(() => reject())). Now, the error is properly propagated to the caller (reject(err)), allowing the UI to handle it correctly.
  2. Better Validation Error Messages: When importing a collection, if the schema validation fails, the error message now includes the specific validation details (e.g., "Field 'name' is required") instead of a generic "The Collection file is corrupted" error. This helps users immediately identify what's wrong with their file.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (no functional changes, no api changes)
  • Documentation update (PR Template)

How Has This Been Tested?

  • Verified that openMultipleCollections now returns the actual error object on failure.
  • Verified that importing an invalid collection file now throws an error with the specific validation message in the console/UI.
  • Verified the PR template renders correctly on GitHub.

Contribution Checklist:

  • The pull request only addresses one issue or adds one feature.
  • The pull request does not introduce any breaking changes
  • I have read the contribution guidelines.

Summary by CodeRabbit

  • Bug Fixes

    • Enhanced error propagation and messaging for collection operations
    • Improved error logging for schema validation during imports
  • Documentation

    • Updated pull request template with new sections and expanded contribution guidelines

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Feb 20, 2026

Walkthrough

The PR updates the GitHub PR template with new guided sections, improves error handling and logging in Redux collection actions to pass explicit error objects, and enhances error messages in schema validation by appending original error details.

Changes

Cohort / File(s) Summary
PR Template Updates
.github/PULL_REQUEST_TEMPLATE.md
Restructured template with new "Related Issue" and "Type of Change" sections; expanded checklist to include AI usage disclosure, single-issue focus, breaking change notes, and screenshots guidance.
Redux Action Error Handling
packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js
Improved error propagation in openMultipleCollections by passing error object to reject; added logging in scanForBrunoFiles success path with result preservation.
Schema Validation Error Reporting
packages/bruno-app/src/utils/importers/common.js
Changed error logging from console.log to console.error; enhanced error message clarity by appending original error details to BrunoError.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • helloanoop
  • lohit-bruno
  • bijin-bruno
  • naman-bruno

Poem

🐛 Error messages now sing clear,
Redux flows with better cheer,
Templates guide the way ahead,
Small fixes, thoughtfully spread. ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: error handling improvements in collections/actions and utils/importers, plus PR template updates.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js (1)

3064-3077: ⚠️ Potential issue | 🟡 Minor

Two issues in scanForBrunoFiles: debug log artifact + error swallowing in catch.

  1. Line 3070 — debug log: console.log('scan done', res) is a debug artifact. This PR's only functional need here was resolve(res) (the previous .then(resolve) already did that). Leaving it in adds noise to production devtools output.

  2. Line 3074 — reject() without err: This is the exact same error-swallowing pattern that was fixed in openMultipleCollections. Callers of scanForBrunoFiles will receive an undefined rejection reason on failure, which the PR explicitly aimed to address.

🐛 Proposed fix
-      .then((res) => {
-        console.log('scan done', res);
-        resolve(res);
-      })
+      .then(resolve)
       .catch((err) => {
-        reject();
+        reject(err);
       });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js`
around lines 3064 - 3077, In scanForBrunoFiles, remove the debug
console.log('scan done', res) and ensure the catch forwards the real error
instead of swallowing it; specifically, in the promise returned by
ipcRenderer.invoke('renderer:scan-for-bruno-files', dir) (inside
scanForBrunoFiles) stop logging the result and call reject(err) (or let the
promise chain propagate the error) so callers receive the actual error object.
.github/PULL_REQUEST_TEMPLATE.md (1)

26-26: ⚠️ Potential issue | 🟡 Minor

Checklist item phrasing is inconsistent — reads as an instruction, not a confirmation.

Every other item is phrased in the first person affirming something already done ("I've used AI…", "I have read…"). This item reads as a future action, making it unclear whether contributors should check it before or after they've done it.

✏️ Suggested reword
-- [ ] **Create an issue and link to the pull request.**
+- [ ] **I have created/linked a related issue in the PR description.**
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/PULL_REQUEST_TEMPLATE.md at line 26, Replace the checklist item text
that currently reads "[ ] **Create an issue and link to the pull request.**"
with an affirmation phrased like the other items, e.g. "[ ] **I created an issue
and linked this pull request.**" to match the first-person confirmation style
used elsewhere in the template; update the exact string in the
.github/PULL_REQUEST_TEMPLATE.md checklist so the wording is consistent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In @.github/PULL_REQUEST_TEMPLATE.md:
- Line 26: Replace the checklist item text that currently reads "[ ] **Create an
issue and link to the pull request.**" with an affirmation phrased like the
other items, e.g. "[ ] **I created an issue and linked this pull request.**" to
match the first-person confirmation style used elsewhere in the template; update
the exact string in the .github/PULL_REQUEST_TEMPLATE.md checklist so the
wording is consistent.

In `@packages/bruno-app/src/providers/ReduxStore/slices/collections/actions.js`:
- Around line 3064-3077: In scanForBrunoFiles, remove the debug
console.log('scan done', res) and ensure the catch forwards the real error
instead of swallowing it; specifically, in the promise returned by
ipcRenderer.invoke('renderer:scan-for-bruno-files', dir) (inside
scanForBrunoFiles) stop logging the result and call reject(err) (or let the
promise chain propagate the error) so callers receive the actual error object.

@sid-bruno
Copy link
Copy Markdown
Collaborator

Hey @dipanshurdev,
thanks for the PR, though I don't think they should be in the same PR. the PR template should be a separate PR and the error handling another.

Another thing, I'd like to understand why the changes were made and what value do you think they add to the app.

@dipanshurdev
Copy link
Copy Markdown
Author

Hey @dipanshurdev, thanks for the PR, though I don't think they should be in the same PR. the PR template should be a separate PR and the error handling another.

Another thing, I'd like to understand why the changes were made and what value do you think they add to the app.

Hi @sid-bruno, sorry for the delay. Thanks for the feedback! I totally understand. I will split these into two separate PRs: one for the template and one for the error handling.

Rationale for the changes:

PR Template: I noticed some PRs lack context or categorization. Adding "Related Issue" and "Type of Change" prompts contributors to provide this upfront, which help you triage and review faster.
Error Handling & Logging:
reject(err): Passing the actual error object in promises (like in open-multiple-collections) ensures that any downstream listeners can display specific feedback or log richer debugging info, rather than just knowing a generic failure happened.
Detailed Error Messages: Changing "corrupted" to corrupted: ${err.message} in the importer helps users troubleshoot. Often a file isn't "corrupted" but might have a syntax error or a permission issue; showing the message makes this clear.
console.error: I've updated some console.log calls to console.error for better visibility in development tools when something actually fails.

I'll go ahead and split these now.

@dipanshurdev
Copy link
Copy Markdown
Author

Hi @sid-bruno, thanks for the feedback! I've split these into two separate PRs.

Rationale for the changes:

PR Template: Prompts contributors for context (issues, type of change) upfront, helping triage.
Error Handling:
reject(err) passes actual errors up the chain for better debugging.
Detailed BrunoError messages help users identify why an import failed (e.g. syntax vs permissions).
console.error improves visibility of real failures in dev tools.
I've just updated this PR to only contain the code changes, and opened #7703 for the template.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants