=doc add custom ValidationRejection handling to samples
This commit is contained in:
parent
dcfa56e547
commit
565b480b2e
2 changed files with 10 additions and 1 deletions
|
|
@ -25,6 +25,9 @@ object MyRejectionHandler {
|
|||
.handle { case AuthorizationFailedRejection ⇒
|
||||
complete((Forbidden, "You're out of your depth!"))
|
||||
}
|
||||
.handle { case ValidationRejection(msg, _) ⇒
|
||||
complete((InternalServerError, "That wasn't valid! " + msg))
|
||||
}
|
||||
.handleAll[MethodRejection] { methodRejections ⇒
|
||||
val names = methodRejections.map(_.supported.name)
|
||||
complete((MethodNotAllowed, s"Can't do that! Supported: ${names mkString " or "}!"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue