Skip to content
This repository has been archived by the owner on May 24, 2023. It is now read-only.

Improve error reporting for operator-courier related errors #49

Merged
merged 5 commits into from
Apr 2, 2019

Conversation

chmeliik
Copy link
Contributor

Addresses #29.

Copy link
Contributor

@MartinBasti MartinBasti left a comment

Choose a reason for hiding this comment

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

Looks good, but I had few comments

docs/usage/v1.md Outdated
@@ -44,14 +44,19 @@ Error messages have following format:
"message": "<detailed error description>",
}
```
There may potentially be other fields providing further details,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd be more explicit which particular errors will provide that information. It can be part of explanation cell IMO

omps/errors.py Outdated
@@ -13,6 +13,14 @@ class OMPSError(Exception):
"""Base OMPSError"""
code = 500

def to_json(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not a JSON, it returns python dict, this method should be called differently: to_dict for example.

tests/test_quay.py Show resolved Hide resolved
omps/errors.py Outdated
def to_json(self):
data = super().to_json()
if self.validation_info is not None:
data.update({'validation_info': self.validation_info})
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO we should always return that key in response, but with empty dict

omps/errors.py Outdated
def to_json(self):
data = super().to_json()
if self.quay_response is not None:
data.update({'quay_response': self.quay_response})
Copy link
Contributor

Choose a reason for hiding this comment

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

IMO we should always return that key in response, but with empty dict when undefined

@MartinBasti
Copy link
Contributor

Please set requirement for operator-courier >= 1.2.1 in setup.py

@chmeliik
Copy link
Contributor Author

Made the changes as @MartinBasti requested.

omps/errors.py Outdated
@@ -13,6 +13,14 @@ class OMPSError(Exception):
"""Base OMPSError"""
code = 500

def to_dict(self):
"""Turn the exception into json data for use as an error response"""
Copy link
Contributor

Choose a reason for hiding this comment

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

s/json/something else/ :-)

omps/errors.py Outdated

def to_dict(self):
data = super().to_dict()
data.update({'quay_response': self.quay_response})
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not data['quay_response'] = self.quay_response when we update only one item

… issues

Signed-off-by: Adam Cmiel <acmiel@redhat.com>
Signed-off-by: Adam Cmiel <acmiel@redhat.com>
Signed-off-by: Adam Cmiel <acmiel@redhat.com>
Signed-off-by: Adam Cmiel <acmiel@redhat.com>
Signed-off-by: Adam Cmiel <acmiel@redhat.com>
@chmeliik
Copy link
Contributor Author

chmeliik commented Apr 2, 2019

Rebased and fixed issues.

Copy link
Contributor

@MartinBasti MartinBasti left a comment

Choose a reason for hiding this comment

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

LGTM

@MartinBasti MartinBasti merged commit e8a177a into release-engineering:master Apr 2, 2019
@chmeliik chmeliik deleted the error-reporting branch April 4, 2019 07:19
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.

None yet

2 participants