Would you not be better off with something like:

```scala
clazz match {
  case errorHandler: CSRFErrorHandler => ...
}