Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Use StandardError over Exception#775

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
denys281 wants to merge1 commit intorubocop:master
base:master
Choose a base branch
Loading
fromdenys281:raise-exception

Conversation

denys281
Copy link

@bquorningbquorning changed the titleUse StandartError over ExceptionUse StandardError over ExceptionNov 12, 2019
@@ -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 aboutwhy one should notraise 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?

@denys281
Copy link
Author

@marcandre Could you take a look? Cop w merged some time ago.

@marcandre
Copy link
Contributor

This PR still needs work...
It's true one should not raise anException, but it is not true one should raise aStandardException; it's more an abstract base class than anything else.
One should raise the appropriate exception (e.g.TypeError) or if nothing fits, aRuntimeError (which shouldn't be specified).
Maybe it would be best to modify the "don't rescueException" section, as they are related... Don't raise one because you should not rescue those...

jgomo3 and pirj reacted with thumbs up emoji

@pirj
Copy link
Member

Ping@denys281

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

@pirjpirjpirj left review comments

@bquorningbquorningbquorning left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

4 participants
@denys281@marcandre@pirj@bquorning

[8]ページ先頭

©2009-2025 Movatter.jp