Skip to content

Commit

Permalink
Merge pull request #59 from brianstien/guard_error_type
Browse files Browse the repository at this point in the history
Guard against undefined method errors
  • Loading branch information
brianstien authored May 5, 2017
2 parents f933f7a + 676ed90 commit 84e3855
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/active_remote/rpc_adapters/protobuf_adapter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ def execute(rpc_method, request_args)
private

def protobuf_error_class(error)
return ::ActiveRemote::ActiveRemoteError unless error.respond_to?(:error_type)

case error.error_type
when ::Protobuf::Socketrpc::ErrorReason::BAD_REQUEST_DATA
::ActiveRemote::BadRequestDataError
Expand All @@ -60,7 +62,7 @@ def protobuf_error_class(error)
when ::Protobuf::Socketrpc::ErrorReason::IO_ERROR
::ActiveRemote::IOError
else
ActiveRemoteError
::ActiveRemote::ActiveRemoteError
end
end

Expand Down

0 comments on commit 84e3855

Please sign in to comment.