Skip to content

Commit

Permalink
fixup! fixup! Refactor: Improve prices API code with better HTTP errors
Browse files Browse the repository at this point in the history
  • Loading branch information
hoh committed Jan 18, 2024
1 parent af9b16b commit d85b258
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/aleph/web/controllers/prices.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from aleph.db.models import MessageDb, MessageStatusDb
from aleph.services.cost import compute_cost, compute_flow_cost
from aleph.types.db_session import DbSession, DbSessionFactory
from aleph.types.message_status import MessageStatus

LOGGER = logging.getLogger(__name__)

Expand All @@ -23,9 +24,9 @@ class HTTPProcessing(HTTPException):

# Mapping between message statuses to their corresponding exceptions and messages
MESSAGE_STATUS_EXCEPTIONS = {
MessageStatusDb.status.PENDING: (HTTPProcessing, "Message still pending"),
MessageStatusDb.status.REJECTED: (web.HTTPNotFound, "This message was rejected"),
MessageStatusDb.status.FORGOTTEN: (
MessageStatus.PENDING: (HTTPProcessing, "Message still pending"),
MessageStatus.REJECTED: (web.HTTPNotFound, "This message was rejected"),
MessageStatus.FORGOTTEN: (
web.HTTPGone,
"This message has been forgotten",
),
Expand Down

0 comments on commit d85b258

Please sign in to comment.