Add a constructor to SendwithusError that stores content - #78
Merged
Conversation
Member
|
Thanks so much @DaleSeo! We'll have someone take a look at this. |
Contributor
|
Thanks for the contribution, looks good to me. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Hi! I'm a user of this library and I'd like to make a suggestion to improve user experience around error handling.
Motivation and Context
As seen below, the
contentis being passed in when creating errors and raising them.sendwithus_python/sendwithus/__init__.py
Lines 153 to 158 in 45c39c4
On the other hand, none of the error classes doesn't implement their constructor.
sendwithus_python/sendwithus/exceptions.py
Lines 1 to 14 in 45c39c4
From the library users' perspective, this means they have to access the content of the errors like below, which is a bit error-prone (IndexError) and not very readable. It could be obvious to experienced Python developers who have a good understanding of how built-in
Exceptionworks internally but I had to spend quite some time to dig into your code to figure this out.So, my suggestion is to add a constructor to
SendwithusErrorthat stores the content value in itscontentattribute. I think It would be great if the content of the errors could be accessed this way instead.