throws

scala.throws
final class throws[T <: Throwable](cause: String = ...) extends StaticAnnotation

Annotation for specifying the exceptions thrown by a method. For example:

class Reader(fname: String) {
 private val in = new BufferedReader(new FileReader(fname))
 @throws[IOException]("if the file doesn't exist")
 def read() = in.read()
}

Type parameters

T

the type of exception that the annotated method may throw

Value parameters

cause

a description of the condition under which the exception is thrown

Attributes

Source
throws.scala
Graph
Supertypes
class Annotation
class Object
trait Matchable
class Any

Members list

Value members

Constructors

def this(clazz: Class[T])

Attributes

Source
throws.scala