Skip to content

Commit

Permalink
don't swallow stack traces on unchecked exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
bjaglin committed Jun 24, 2022
1 parent dd84703 commit 82187f1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/main/scala/scalafix/internal/sbt/ScalafixInterface.scala
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ class ScalafixInterface private (
def withArgs(args: Arg*): ScalafixInterface = {
val newScalafixArguments = args.foldLeft(scalafixArguments) { (acc, arg) =>
try arg(acc)
catch { case NonFatal(e) => throw new InvalidArgument(e.getMessage) }
catch {
case e: ScalafixException => throw new InvalidArgument(e.getMessage)
}
}
new ScalafixInterface(newScalafixArguments, this.args ++ args)
}
Expand All @@ -101,7 +103,9 @@ class ScalafixInterface private (

def rulesThatWillRun(): Seq[ScalafixRule] =
try scalafixArguments.rulesThatWillRun().asScala
catch { case NonFatal(e) => throw new InvalidArgument(e.getMessage) }
catch {
case e: ScalafixException => throw new InvalidArgument(e.getMessage)
}

def validate(): Option[ScalafixException] =
Option(scalafixArguments.validate().orElse(null))
Expand Down

0 comments on commit 82187f1

Please sign in to comment.