Created
March 7, 2023 16:50
-
-
Save arturaz/5db742eee5df7a7c62ece88dd90c897b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/quill-sql/src/main/scala/io/getquill/util/Format.scala b/quill-sql/src/main/scala/io/getquill/util/Format.scala | |
index 31e8e7e1..040690ad 100644 | |
--- a/quill-sql/src/main/scala/io/getquill/util/Format.scala | |
+++ b/quill-sql/src/main/scala/io/getquill/util/Format.scala | |
@@ -120,7 +120,9 @@ object Format { | |
linesTrimmedLast.mkString("\n") | |
val formatted = | |
- Try { | |
+ // We can't use `Try` here because it won't catch linking errors as those are considered | |
+ // fatal. But we don't want to crash on a missing dependency here, thus the try-catch. | |
+ try { | |
// val formatCls = classOf[ScalafmtFormat.type] | |
// val result = formatCls.getMethod("apply").invoke(null, encosedCode) | |
// println("============ GOT HERE ===========") | |
@@ -134,8 +136,11 @@ object Format { | |
.replace("_!=", "!="), | |
showErrorTrace | |
) | |
- }.getOrElse { | |
+ } | |
+ catch { (t: Throwable) => | |
println("====== WARNING: Scalafmt Not Detected ====") | |
+ println("If you want to use the formatter, add the following to your build.sbt") | |
+ println("libraryDependencies += \"org.scalameta\" %% \"scalafmt-core\" % \"3.1.0\"") | |
encosedCode | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment