Skip to content

Enhance: improve error messages across the codebase#874

Open
raywcm wants to merge 1 commit into
pyupio:mainfrom
raywcm:chore/enhance-error-messages
Open

Enhance: improve error messages across the codebase#874
raywcm wants to merge 1 commit into
pyupio:mainfrom
raywcm:chore/enhance-error-messages

Conversation

@raywcm

@raywcm raywcm commented Jun 3, 2026

Copy link
Copy Markdown

Summary

Improves error messages throughout the Safety CLI to be more descriptive, actionable, and user-friendly.

Changes

safety/errors.py — Core error classes (13 error types improved):

  • Rewrote vague messages ("Unhandled exception happened""An unexpected Safety CLI error occurred")
  • Added actionable guidance to network errors (proxy, SSL, timeout)
  • Fixed bug in MalformedDatabase where info was computed twice and first assignment was lost

safety/config/proxy.py — Proxy config errors:

  • Added source context ("(from CLI)", "(from config file)") to all ValueError messages
  • Included actionable guidance referencing --proxy-host flag and config section

safety/output_utils.py — Output utility errors:

  • Made JSON validation errors show the expected structure
  • Show unsupported format values in error messages

Motivation

Clear and informative error messages are essential for good user experience. These changes help users understand what went wrong and how to fix it.

Closes #577

- Make error messages more descriptive and actionable
- Add context to proxy configuration errors
- Add user-friendly guidance to network errors
- Fix MalformedDatabase bug (info overwritten)

Closes pyupio#577
@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7c16dba8-de05-4595-82c3-5dc526b62eb3

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ 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.

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.

Enhance Error Messages

1 participant