Skip to content

Do not throw new Error() #400

@samrocketman

Description

@samrocketman

https://github.com/kohsuke/github-api/search?utf8=%E2%9C%93&q=%22new+Error%22&type=

In general, this seems to be a bad idea. See also comments in jenkinsci/ghprb-plugin#570. This PR for the GHPRB plugin is left with the dilemma of catching throwable because there's no other choice since this API throws java.lang.Error.

A quote from java.lang.Error javadoc:

An Error is a subclass of Throwable that indicates serious problems that a reasonable application should not try to catch.

Instead, consider throwing IllegalStateException.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions