Is there a full specification for pattern matching possibilities of Scala?
I am unable to fix following code:
something match {
case e @ (sae: ServerApiException if sae.statusCode == 401 | _: UnauthorizedException) => {
doSomething(e)
}
...
}
(It does not compile in 2.8.1.)
I’m not sure I’d write the code this way; it’s hard to follow (in addition to not working in its original form).
I’d rather go for something like
to avoid duplicate code. Or you could use options:
if you prefer to write the method afterwards. But I think the first way is likely the clearest.