play.core.ApplicationProvider.scala Maven / Gradle / Ivy
The newest version!
/*
* Copyright (C) 2009-2016 Lightbend Inc.
*/
package play.core
import java.io._
/**
* provides source code to be displayed on error pages
*/
trait SourceMapper {
def sourceOf(className: String, line: Option[Int] = None): Option[(File, Option[Int])]
def sourceFor(e: Throwable): Option[(File, Option[Int])] = {
e.getStackTrace.find(element => sourceOf(element.getClassName).isDefined).flatMap { interestingStackTrace =>
sourceOf(interestingStackTrace.getClassName, Option(interestingStackTrace.getLineNumber))
}
}
}
//@see compare-to-play.md