close
Skip to content

Expose configuration exceptions in scalafmt#836

Merged
nedtwigg merged 4 commits into
diffplug:mainfrom
loveleif:expose-scalafmt-errors
Apr 8, 2021
Merged

Expose configuration exceptions in scalafmt#836
nedtwigg merged 4 commits into
diffplug:mainfrom
loveleif:expose-scalafmt-errors

Conversation

@loveleif

@loveleif loveleif commented Apr 8, 2021

Copy link
Copy Markdown
Contributor

Read scalafmt configuration in a way that shows parsing errors.

Before this change invalid scalafmt configuration files would fail like this:

java.lang.reflect.InvocationTargetException
    ...
Caused by: java.util.NoSuchElementException: Either.right.value on Left
    at scala.util.Either$RightProjection.get(Either.scala:453
    ...

With this change any exceptions from scalafmt configuration parsing will be visible, for example:

java.lang.reflect.InvocationTargetException
    ...
Caused by: java.lang.IllegalStateException: Invalid fields: invalidScalaFmtConfigField
    at metaconfig.Configured.get(Configured.scala:11)
    ...

Resolves #837

@loveleif
loveleif marked this pull request as draft April 8, 2021 19:28
@nedtwigg

nedtwigg commented Apr 8, 2021

Copy link
Copy Markdown
Member

LGTM! Update all 3 changelogs, run spotlessApply, and I'd be happy to merge if all the tests still pass.

@loveleif
loveleif marked this pull request as ready for review April 8, 2021 19:49
@nedtwigg

nedtwigg commented Apr 8, 2021

Copy link
Copy Markdown
Member

@loveleif

loveleif commented Apr 8, 2021

Copy link
Copy Markdown
Contributor Author

the tests are failing

Sorry about that @nedtwigg, all green now :). By the way, thanks for all the hard work and making spotless available for anyone to use.

@nedtwigg

nedtwigg commented Apr 8, 2021

Copy link
Copy Markdown
Member

Thanks for the contribution! Publishing is gunked up atm due to the jcenter sunset, but it'll get published by tomorrow.

@nedtwigg
nedtwigg merged commit 2c610a6 into diffplug:main Apr 8, 2021
@nedtwigg

Copy link
Copy Markdown
Member

Released in plugin-maven 2.10.0 and plugin-gradle 5.12.0.

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.

Show scalafmt configuration errors

2 participants