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

ScalafmtReporter: allow null cause in 3-arg error #3198

Merged
merged 1 commit into from
Apr 28, 2022

Conversation

kitbellew
Copy link
Collaborator

No description provided.

@@ -35,7 +35,8 @@ public interface ScalafmtReporter {
* when the error appeared as a position.
*/
default void error(Path file, String message, Throwable e) {
error(file, new ScalafmtException(message, e));
if (e == null) error(file, message);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why would we want to have a null Throwable? Isn't it better to create ScalafmtException instead?

Choose a reason for hiding this comment

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

I would like to be able to call error(file, throwable.getMessage, throwable.getCause) and not worry about .getCause returning a null.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

oops, again replied using my alter ego :)

Copy link
Contributor

@tgodzik tgodzik 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 the explanation!

@kitbellew kitbellew merged commit 0846aa0 into scalameta:master Apr 28, 2022
@kitbellew kitbellew deleted the 3198 branch April 28, 2022 15:59
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.

3 participants