Skip to content
This repository has been archived by the owner on Mar 20, 2018. It is now read-only.

Fix error-handling to use new gRPC exceptions #131

Merged
merged 2 commits into from
Sep 20, 2016

Conversation

geigerj
Copy link
Contributor

@geigerj geigerj commented Sep 19, 2016

Previously, we were catching and wrapping AbortionError, which is no
longer used by gRPC. Instead, use RpcError.

/cc @dhermes

Fixes #129 and #130

Previously, we were catching and wrapping AbortionError, which is no
longer used by gRPC. Instead, use RpcError.
@codecov-io
Copy link

codecov-io commented Sep 19, 2016

Current coverage is 98.02% (diff: 100%)

Merging #131 into master will increase coverage by 0.82%

@@             master       #131   diff @@
==========================================
  Files             8          8          
  Lines           608        608          
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits            591        596     +5   
+ Misses           17         12     -5   
  Partials          0          0          

Powered by Codecov. Last update 9a42e3b...69efb57

@dhermes
Copy link
Contributor

dhermes commented Sep 19, 2016

Surprised how easy this fix was!

Copy link
Contributor

@bjwatson bjwatson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one comment. Otherwise LGTM.

self.assertEqual(code, grpc.StatusCode.UNKNOWN)
self.assertEqual(code, grpc.STATUS_CODE_NAMES['UNKNOWN'])
self.assertIsNone(grpc.exc_to_code(Exception))
self.assertIsNone(grpc.exc_to_code(grpc.RpcError()))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably also test an RpcError that contains a code.

Copy link
Contributor Author

@geigerj geigerj Sep 20, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It already does: MyError is an RpcError that contains a code (StatusCode.UNKNOWN).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, got it!

Copy link
Contributor

@bjwatson bjwatson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

self.assertEqual(code, grpc.StatusCode.UNKNOWN)
self.assertEqual(code, grpc.STATUS_CODE_NAMES['UNKNOWN'])
self.assertIsNone(grpc.exc_to_code(Exception))
self.assertIsNone(grpc.exc_to_code(grpc.RpcError()))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, got it!

@geigerj geigerj merged commit 7b3172b into googleapis:master Sep 20, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants