mirror of https://github.com/sbt/sbt.git
Silence boring Eclipse warnings: catching all exceptions
Here I make explicit where catching all exceptions is intended. Mark Harrah corrected one decision during review.
This commit is contained in:
parent
40bc141058
commit
236143be8d
|
|
@ -34,7 +34,7 @@ object Boot
|
|||
case b: BootException => errorAndExit(b.toString)
|
||||
case r: xsbti.RetrieveException => errorAndExit("Error: " + r.getMessage)
|
||||
case r: xsbti.FullReload => Some(r.arguments)
|
||||
case e =>
|
||||
case e: Throwable =>
|
||||
e.printStackTrace
|
||||
errorAndExit(Pre.prefixError(e.toString))
|
||||
}
|
||||
|
|
@ -55,7 +55,12 @@ object Boot
|
|||
System.setProperty("sbt.log.format", "true")
|
||||
} catch {
|
||||
case ignore: ClassNotFoundException =>
|
||||
case ex => println("Jansi found on class path but initialization failed: " + ex)
|
||||
/* The below code intentionally traps everything. It technically shouldn't trap the
|
||||
* non-StackOverflowError VirtualMachineErrors and AWTError would be weird, but this is PermGen
|
||||
* mitigation code that should not render sbt completely unusable if jansi initialization fails.
|
||||
* [From Mark Harrah, https://github.com/sbt/sbt/pull/633#issuecomment-11957578].
|
||||
*/
|
||||
case ex: Throwable => println("Jansi found on class path but initialization failed: " + ex)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ object MainLoop
|
|||
case e: xsbti.FullReload =>
|
||||
deleteLastLog(logBacking)
|
||||
throw e // pass along a reboot request
|
||||
case e =>
|
||||
case e: Throwable =>
|
||||
System.err.println("sbt appears to be exiting abnormally.\n The log file for this session is at " + logBacking.file)
|
||||
deleteLastLog(logBacking)
|
||||
throw e
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ object TrapExit
|
|||
catch
|
||||
{
|
||||
case e: TrapExitSecurityException => throw e
|
||||
case x =>
|
||||
case x: Throwable =>
|
||||
code.set(1) //exceptions in the main thread cause the exit code to be 1
|
||||
throw x
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ object SettingsTest extends Properties("settings")
|
|||
|
||||
def evaluate(settings: Seq[Setting[_]]): Settings[Scope] =
|
||||
try { make(settings)(delegates, scopeLocal, showFullKey) }
|
||||
catch { case e => e.printStackTrace; throw e }
|
||||
catch { case e: Throwable => e.printStackTrace; throw e }
|
||||
}
|
||||
// This setup is a workaround for module synchronization issues
|
||||
final class CCR(intermediate: Int)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ object ErrorHandling
|
|||
{
|
||||
case ex @ (_: Exception | _: StackOverflowError) => Left(ex)
|
||||
case err @ (_: ThreadDeath | _: VirtualMachineError) => throw err
|
||||
case x => Left(x)
|
||||
case x: Throwable => Left(x)
|
||||
}
|
||||
|
||||
def convert[T](f: => T): Either[Exception, T] =
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class BufferedLogger(delegate: AbstractLogger) extends BasicLogger
|
|||
clear()
|
||||
result
|
||||
}
|
||||
catch { case e => stopQuietly(); throw e }
|
||||
catch { case e: Throwable => stopQuietly(); throw e }
|
||||
}
|
||||
def stopQuietly() = synchronized { try { stop() } catch { case e: Exception => () } }
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue