Skip to content

Adds support for instance attribute and custom attributes#11

Open
Axeltherabbit wants to merge 5 commits intoshivanshs9:masterfrom
Axeltherabbit:master
Open

Adds support for instance attribute and custom attributes#11
Axeltherabbit wants to merge 5 commits intoshivanshs9:masterfrom
Axeltherabbit:master

Conversation

@Axeltherabbit
Copy link

As I mentioned here #10 I wasn't sure if there was already a way to do this, if there was never mind I guess.

example:

class Http400BadRequest(APIException):
    status_code = status.HTTP_400_BAD_REQUEST
    instance = "test/custom/thingy"
    extensions = {"errors": "custom stuff", "more custom things": "asd"}

Copy link
Owner

@shivanshs9 shivanshs9 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, suggested some small improvements.

data['type'] = problem_type
if problem_instance:
data['instance'] = problem_instance
data.update(problem_extensions)
Copy link
Owner

Choose a reason for hiding this comment

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

problem_extensions should be dict so please do a type check here

@Axeltherabbit
Copy link
Author

Are the changes fine? Can this be merged?

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