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

ScalafmtDynamicError: somewhat clarify messages #2960

Merged
merged 1 commit into from
Dec 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.scalafmt.dynamic

import java.net.URL
import java.nio.file.Path

import scala.util.control.NoStackTrace
Expand Down Expand Up @@ -30,14 +29,18 @@ object ScalafmtDynamicError {
configPath: Path,
version: ScalafmtVersion,
cause: Throwable = null
) extends ConfigError(configPath, s"failed to download v=$version", cause)
) extends ConfigError(configPath, s"[v$version] failed to download", cause)

class CorruptedClassPath(
configPath: Path,
version: ScalafmtVersion,
val urls: Seq[URL],
urls: Seq[String],
cause: Throwable
) extends ConfigError(configPath, s"corrupted class path v=$version", cause)
) extends ConfigError(
configPath,
urls.mkString(s"[v$version] corrupted class path: [", ",", "]"),
cause
)

class ConfigInvalidVersion(configPath: Path, version: String)
extends ConfigError(configPath, s"Invalid version: $version")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ object ScalafmtModuleLoader {
ScalafmtReflect(classloader, version)
}.toEither.left.map {
case e: ReflectiveOperationException =>
new CorruptedClassPath(configPath, version, urls, e)
val urlStrs =
urls.map(x => if (x.getProtocol == "file") x.getFile else x.toString)
new CorruptedClassPath(configPath, version, urlStrs, e)
case e => new UnknownConfigError(configPath, e)
}

Expand Down