Skip to content
Discussion options

You must be logged in to vote

Hey! 👋
You’re actually on the right track.
For runtime errors (inside receive_json), catching exceptions and sending a structured "error" message back to the client is totally fine — that’s how most production apps handle it.

async def receive_json(self, content):
try:
# your logic here
await self.send_json({"type": "success", "data": "ok"})
except Exception as e:
await self.send_json({"type": "error", "message": str(e)})

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by damnNepali
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants