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

New error codes #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions webserver/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import flask
import stellar_base.keypair
import stellar_base.utils
import stellar_base.exceptions

import util.db

Expand Down Expand Up @@ -228,24 +229,27 @@ def wrapped_decorator(*args, **kwargs):
return wrapped_decorator


CUSTOM_EXCEPTION_STATUSES[MissingFields] = 400
CUSTOM_EXCEPTION_STATUSES[InvalidField] = 400
CUSTOM_EXCEPTION_STATUSES[AssertionError] = 400
CUSTOM_EXCEPTION_STATUSES[ExtraField] = 400
CUSTOM_EXCEPTION_STATUSES[InvalidField] = 400
CUSTOM_EXCEPTION_STATUSES[MissingFields] = 400
CUSTOM_EXCEPTION_STATUSES[util.db.DataTooBig] = 400
CUSTOM_EXCEPTION_STATUSES[AssertionError] = 400
CUSTOM_EXCEPTION_STATUSES[FingerprintMismatch] = 403
CUSTOM_EXCEPTION_STATUSES[InvalidSignature] = 403
CUSTOM_EXCEPTION_STATUSES[NotImplementedError] = 501


INTERNAL_ERROR_CODES[MissingFields] = 100
INTERNAL_ERROR_CODES[InvalidField] = 101
INTERNAL_ERROR_CODES[ExtraField] = 106
INTERNAL_ERROR_CODES[InvalidNonce] = 102
INTERNAL_ERROR_CODES[InvalidSignature] = 103
INTERNAL_ERROR_CODES[FingerprintMismatch] = 104
INTERNAL_ERROR_CODES[util.db.DataTooBig] = 105
INTERNAL_ERROR_CODES[ExtraField] = 106
INTERNAL_ERROR_CODES[DebugOnly] = 121
INTERNAL_ERROR_CODES[stellar_base.exceptions.NoStellarSecretOrAddressError] = 205
INTERNAL_ERROR_CODES[stellar_base.exceptions.StellarSecretInvalidError] = 206
INTERNAL_ERROR_CODES[stellar_base.exceptions.StellarAddressInvalidError] = 207

Choose a reason for hiding this comment

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

@yaroslavr-itd , I think nothing will ever happen with these if they do not show up in CUSTOM_EXCEPTION_STATUSES.



# Since this is a decorator the handler argument will never be None, it is
Expand Down