Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use StandardError over Exception #775

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1931,6 +1931,19 @@ end

Prefer the use of exceptions from the standard library over introducing new exception classes.

=== Do not `raise` `Exception` [[raise-exception]]

Use `StandardError` over `Exception`.

Choose a reason for hiding this comment

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

Perhaps this section should include a sentence about why one should not raise Exception.

Copy link
Author

Choose a reason for hiding this comment

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

Could you help with wording?

Copy link
Member

Choose a reason for hiding this comment

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

@denys281 Would "[Exception] will bypass test frameworks and error reporters" do?


[source,ruby]
----
# bad
raise Exception, 'Error message here'

# good
raise StandardError, 'Error message here'
----

== Assignment & Comparison

=== Parallel Assignment [[parallel-assignment]]
Expand Down