Skip to content

Commit

Permalink
Use HTTP status codes
Browse files Browse the repository at this point in the history
  • Loading branch information
dorner committed Jun 26, 2024
1 parent b3e3230 commit 51738f5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion protoc-gen-rails/internal/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class {{.ControllerName}}Controller < ActionController::Base
render json: GrpcRest.error_msg(e), status: :internal_server_error
end
rescue_from GRPC::BadStatus do |e|
render json: GrpcRest.error_msg(e), status: :internal_server_error
render json: GrpcRest.error_msg(e), status: GrpcRest.grpc_http_status(e.code)
end
rescue_from Google::Protobuf::TypeError do |e|
render json: GrpcRest.error_msg(e), status: :bad_request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class MyServiceController < ActionController::Base
render json: GrpcRest.error_msg(e), status: :internal_server_error
end
rescue_from GRPC::BadStatus do |e|
render json: GrpcRest.error_msg(e), status: :internal_server_error
render json: GrpcRest.error_msg(e), status: GrpcRest.grpc_http_status(e.code)
end
rescue_from Google::Protobuf::TypeError do |e|
render json: GrpcRest.error_msg(e), status: :bad_request
Expand Down

0 comments on commit 51738f5

Please sign in to comment.