-
Notifications
You must be signed in to change notification settings - Fork 277
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
bugfix: Show exception from path matcher correctly #3729
Conversation
scalafmt-cli/src/main/scala/org/scalafmt/cli/ScalafmtCoreRunner.scala
Outdated
Show resolved
Hide resolved
scalafmt-core/shared/src/main/scala/org/scalafmt/config/ProjectFiles.scala
Show resolved
Hide resolved
d97ee45
to
f67e7fa
Compare
a3fc5a9
to
69b9131
Compare
btw. I think using |
69b9131
to
339a0c3
Compare
this i didn't fully understand. |
Ach, ok I didn't know |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, only that leftover blank line :)
scalafmt-cli/src/main/scala/org/scalafmt/cli/ScalafmtCoreRunner.scala
Outdated
Show resolved
Hide resolved
catch { | ||
case _: IllegalArgumentException => | ||
throw new ScalafmtConfigException( | ||
s"Illegal pattern in configuration: $pattern" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what happens if we append message from the exception we caught? will it explain the reason better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried and it seems empty.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ach, actually for Regex we can add it, it's null for Nio matcher
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added reason: ...
line
339a0c3
to
664364d
Compare
Previously, we would just get a stack trace: ``` Exception in thread "main" java.lang.IllegalArgumentException at sun.nio.fs.UnixFileSystem.getPathMatcher(UnixFileSystem.java:286) at org.scalafmt.config.ProjectFiles$FileMatcher$Nio.<init>(ProjectFiles.scala:74) at org.scalafmt.config.ProjectFiles$FileMatcher$.$anonfun$nio$1(ProjectFiles.scala:70) at scala.collection.immutable.List.map(List.scala:250) at scala.collection.immutable.List.map(List.scala:79) at org.scalafmt.config.ProjectFiles$FileMatcher$.create(ProjectFiles.scala:69) at org.scalafmt.config.ProjectFiles$FileMatcher$.nio(ProjectFiles.scala:70) at org.scalafmt.config.ProjectFiles$FileMatcher$.apply(ProjectFiles.scala:64) at org.scalafmt.cli.ScalafmtCoreRunner$.$anonfun$run$2(ScalafmtCoreRunner.scala:27) at metaconfig.Configured$ConfiguredImplicit.fold(Configured.scala:111) at org.scalafmt.cli.ScalafmtCoreRunner$.run(ScalafmtCoreRunner.scala:23) at org.scalafmt.cli.Cli$.runWithRunner(Cli.scala:140) at org.scalafmt.cli.Cli$.run(Cli.scala:91) at org.scalafmt.cli.Cli$.mainWithOptions(Cli.scala:61) at org.scalafmt.cli.Cli$.main(Cli.scala:43) at org.scalafmt.cli.Cli.main(Cli.scala) ``` Reported in VirtusLab/scala-cli#2415
664364d
to
b1d7167
Compare
Previously, we would just get a stack trace:
Reported in VirtusLab/scala-cli#2415