Skip to content

Cleanup unnecessary catch clauses #2212

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

Merged
merged 3 commits into from
Jul 18, 2023

Conversation

lindapaiste
Copy link
Collaborator

Changes:

A catch clause that only rethrows the original error is redundant, and has no effect on the runtime behavior of the program. These redundant clauses can be a source of confusion and code bloat, so it’s better to disallow these unnecessary catch clauses.

  • Deleted lines of code that look like this:
try {

(code here unchanged, but indentation level is reduced)

} catch (err) {
  throw err;
}
  • Or like this:
.catch((err) => {
  throw err;
});

Note: All changed files are in the /server/scripts directory. We don't have any redundant catch clauses in other parts of the codebase.

I have verified that this pull request:

  • has no linting errors (npm run lint)
  • has no test errors (npm run test)
  • is from a uniquely-named feature branch and is up to date with the develop branch.
  • is descriptively named and links to an issue number, i.e. Fixes #123

Copy link
Collaborator

@raclim raclim left a comment

Choose a reason for hiding this comment

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

Thanks for working on this!

@raclim raclim merged commit 3736f25 into processing:develop Jul 18, 2023
@lindapaiste lindapaiste deleted the chore/no-useless-catch branch August 8, 2023 02:01
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.

2 participants