Skip to content

Commit c469638

Browse files
refactor: use HTTP status constants
1 parent 0ba8156 commit c469638

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

quantara/web_app/api/walletconnect.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from typing import Literal, Optional
3030

3131
import redis.asyncio as redis
32-
from fastapi import APIRouter, HTTPException, Request
32+
from fastapi import APIRouter, HTTPException, Request, status
3333
from pydantic import BaseModel, Field, field_validator
3434

3535
# Note: `from __future__ import annotations` is intentionally NOT used here.
@@ -212,7 +212,7 @@ def _signing_key(sub_sid: str) -> str:
212212
async def _validate_session(sid: str) -> dict:
213213
raw = await _redis().get(_session_key(sid))
214214
if raw is None:
215-
raise HTTPException(status_code=404, detail="Pairing session not found or expired")
215+
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Pairing session not found or expired")
216216
return json.loads(raw)
217217

218218

@@ -264,7 +264,7 @@ async def poll_session(session_id: str, request: Request):
264264
if raw is None:
265265
raw = await _redis().get(_signing_key(session_id))
266266
if raw is None:
267-
raise HTTPException(status_code=404, detail="Session not found or expired")
267+
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Session not found or expired")
268268
data = json.loads(raw)
269269
return PollResponse(
270270
session_id=session_id,
@@ -325,7 +325,7 @@ async def submit_signed_envelope(
325325
# Wallet hit the pairing endpoint instead of the signing one.
326326
raw = await _redis().get(_session_key(session_id))
327327
if raw is None:
328-
raise HTTPException(status_code=404, detail="Unknown session")
328+
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="Unknown session")
329329
data = json.loads(raw)
330330
if payload.public_key:
331331
data["public_key"] = payload.public_key

0 commit comments

Comments
 (0)