-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4676 from mirumee/add-error-codes-in-api
Add error codes to API
- Loading branch information
Showing
66 changed files
with
2,151 additions
and
198 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from enum import Enum | ||
|
||
|
||
class AccountErrorCode(Enum): | ||
ACTIVATE_OWN_ACCOUNT = "activate_own_account" | ||
ACTIVATE_SUPERUSER_ACCOUNT = "activate_superuser_account" | ||
DEACTIVATE_OWN_ACCOUNT = "deactivate_own_account" | ||
DEACTIVATE_SUPERUSER_ACCOUNT = "deactivate_superuser_account" | ||
DELETE_NON_STAFF_USER = "delete_non_staff_user" | ||
DELETE_OWN_ACCOUNT = "delete_own_account" | ||
DELETE_STAFF_ACCOUNT = "delete_staff_account" | ||
DELETE_SUPERUSER_ACCOUNT = "delete_superuser_account" | ||
GRAPHQL_ERROR = "graphql_error" | ||
INVALID = "invalid" | ||
INVALID_PASSWORD = "invalid_password" | ||
NOT_FOUND = "not_found" | ||
PASSWORD_ENTIRELY_NUMERIC = "password_entirely_numeric" | ||
PASSWORD_TOO_COMMON = "password_too_common" | ||
PASSWORD_TOO_SHORT = "password_too_short" | ||
PASSWORD_TOO_SIMILAR = "password_too_similar" | ||
REQUIRED = "required" | ||
UNIQUE = "unique" |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
from enum import Enum | ||
|
||
|
||
class CheckoutErrorCode(Enum): | ||
BILLING_ADDRESS_NOT_SET = "billing_address_not_set" | ||
CHECKOUT_NOT_FULLY_PAID = "checkout_not_fully_paid" | ||
GRAPHQL_ERROR = "graphql_error" | ||
INSUFFICIENT_STOCK = "insufficient_stock" | ||
INVALID = "invalid" | ||
INVALID_SHIPPING_METHOD = "invalid_shipping_method" | ||
NOT_FOUND = "not_found" | ||
PAYMENT_ERROR = "payment_error" | ||
QUANTITY_GREATER_THAN_LIMIT = "quantity_greater_than_limit" | ||
REQUIRED = "required" | ||
SHIPPING_ADDRESS_NOT_SET = "shipping_address_not_set" | ||
SHIPPING_METHOD_NOT_APPLICABLE = "shipping_method_not_applicable" | ||
SHIPPING_METHOD_NOT_SET = "shipping_method_not_set" | ||
SHIPPING_NOT_REQUIRED = "shipping_not_required" | ||
TAX_ERROR = "tax_error" | ||
UNIQUE = "unique" | ||
VOUCHER_NOT_APPLICABLE = "voucher_not_applicable" | ||
ZERO_QUANTITY = "zero_quantity" |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from enum import Enum | ||
|
||
|
||
class ShopErrorCode(Enum): | ||
ALREADY_EXISTS = "already_exists" | ||
CANNOT_FETCH_TAX_RATES = "cannot_fetch_tax_rates" | ||
GRAPHQL_ERROR = "graphql_error" | ||
INVALID = "invalid" | ||
NOT_FOUND = "not_found" | ||
REQUIRED = "required" | ||
UNIQUE = "unique" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
from ..checkout.error_codes import CheckoutErrorCode | ||
|
||
|
||
class InsufficientStock(Exception): | ||
def __init__(self, item): | ||
super().__init__("Insufficient stock for %r" % (item,)) | ||
self.item = item | ||
self.code = CheckoutErrorCode.INSUFFICIENT_STOCK |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from enum import Enum | ||
|
||
|
||
class ExtensionsErrorCode(Enum): | ||
GRAPHQL_ERROR = "graphql_error" | ||
INVALID = "invalid" | ||
PLUGIN_MISCONFIGURED = "plugin-misconfigured" | ||
NOT_FOUND = "not_found" | ||
REQUIRED = "required" | ||
UNIQUE = "unique" |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from enum import Enum | ||
|
||
|
||
class GiftCardErrorCode(Enum): | ||
ALREADY_EXISTS = "already_exists" | ||
GRAPHQL_ERROR = "graphql_error" | ||
INVALID = "invalid" | ||
NOT_FOUND = "not_found" | ||
REQUIRED = "required" | ||
UNIQUE = "unique" |
This file contains 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
This file contains 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
Oops, something went wrong.