next.respond(to: request).flatMapError{ (error) in ... switch error { // errorの型をがんばって404と500を振り分ける case ... }