Class: OpenapiRuby::Middleware::ErrorHandler
- Inherits:
-
Object
- Object
- OpenapiRuby::Middleware::ErrorHandler
- Defined in:
- lib/openapi_ruby/middleware/error_handler.rb
Instance Method Summary collapse
Instance Method Details
#invalid_request(errors) ⇒ Object
6 7 8 9 |
# File 'lib/openapi_ruby/middleware/error_handler.rb', line 6 def invalid_request(errors) body = {error: "Request validation failed", details: errors}.to_json [400, {"content-type" => "application/json"}, [body]] end |
#invalid_response(errors) ⇒ Object
16 17 18 19 |
# File 'lib/openapi_ruby/middleware/error_handler.rb', line 16 def invalid_response(errors) body = {error: "Response validation failed", details: errors}.to_json [500, {"content-type" => "application/json"}, [body]] end |
#not_found(path) ⇒ Object
11 12 13 14 |
# File 'lib/openapi_ruby/middleware/error_handler.rb', line 11 def not_found(path) body = {error: "Path not found: #{path}"}.to_json [404, {"content-type" => "application/json"}, [body]] end |