Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/exception handler #26

Merged
merged 12 commits into from
Oct 10, 2017
Merged

Feature/exception handler #26

merged 12 commits into from
Oct 10, 2017

Conversation

OGKevin
Copy link
Contributor

@OGKevin OGKevin commented Sep 18, 2017

#25

  • Exception factory review

  • Explain exceptions in a .md file

  • Final review

Copy link
Contributor

@dnl-blkv dnl-blkv left a comment

Choose a reason for hiding this comment

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

A couple comments

_GLUE_ERROR_MESSAGES = '\n'

def __init__(self, response_code, messages):
class BunqError(Exception):
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's call the base class ApiException and then extend from it. For the case of an unknown exception, we can throw the ApiException itself or make something like UnknownApiErrorException!

from bunq.sdk.exception import BunqError


class ExceptionHandler(Exception):
Copy link
Contributor

Choose a reason for hiding this comment

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

It is not handler. Let's perhaps call it ExceptionFactory?

@OGKevin
Copy link
Contributor Author

OGKevin commented Sep 19, 2017

@dnl-blkv please 👀 and ✅ the first item on the todo list above if you agree plz.

dnl-blkv
dnl-blkv previously approved these changes Sep 21, 2017
@dnl-blkv
Copy link
Contributor

@OGKevin Current state is good! Please proceed with the .md :)

dnl-blkv
dnl-blkv previously approved these changes Sep 21, 2017
Copy link
Contributor

@dnl-blkv dnl-blkv left a comment

Choose a reason for hiding this comment

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

Current state looks good!

@OGKevin OGKevin added this to the v0.12.0 milestone Sep 23, 2017
@OGKevin
Copy link
Contributor Author

OGKevin commented Sep 26, 2017

@dnl-blkv please final 👀

Copy link
Contributor

@dnl-blkv dnl-blkv left a comment

Choose a reason for hiding this comment

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

Please apply the same rephrasing changes as in C#, but, of course, raise should remain raise, because Python :P

@@ -6,6 +6,7 @@

from bunq.sdk import context
from bunq.sdk import exception
from bunq.sdk.exception_factory import ExceptionFactory
Copy link
Contributor

Choose a reason for hiding this comment

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

@OGKevin Oh, just realised one thing: is the order of import statements correct here? :D

Copy link
Contributor

Choose a reason for hiding this comment

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

So was it correct? :D
Feels like organise imports would change it :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well there is nothing wrong with these statements :P Its grouped correctly. The thing that reformat does is from bunq.sdk import context, exception, security which is against PEP8

EXCEPTIONS.md Outdated
@@ -0,0 +1,73 @@
## Exceptions

Copy link
Contributor

Choose a reason for hiding this comment

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

Like in every SDK, this newline can go (just internal formatting :D)

EXCEPTIONS.md Outdated

----
#### Possible Exceptions

Copy link
Contributor

Choose a reason for hiding this comment

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

This newline can go too


def glue_messages(self, messages):
@property
def message(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we use the base class property here?

Copy link
Contributor Author

@OGKevin OGKevin Oct 10, 2017

Choose a reason for hiding this comment

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

Hmm well python handles the message a little bit different tho take a look here: https://stackoverflow.com/questions/4690600/python-exception-message-capturing

So what do you think based on this🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

@OGKevin thanks for explanation! Let's keep it as we have it now :)

@@ -6,6 +6,7 @@

from bunq.sdk import context
from bunq.sdk import exception
from bunq.sdk.exception_factory import ExceptionFactory
Copy link
Contributor

Choose a reason for hiding this comment

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

So was it correct? :D
Feels like organise imports would change it :)

@dnl-blkv dnl-blkv merged commit c006891 into develop Oct 10, 2017
@dnl-blkv dnl-blkv deleted the feature/exception-handler branch October 10, 2017 17:21
@dnl-blkv
Copy link
Contributor

@andrederoos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants