Skip to content

feat: add structured error codes to server error frames#210

Open
almuslavish wants to merge 1 commit into
RiftCore00:devfrom
almuslavish:add-error-codes
Open

feat: add structured error codes to server error frames#210
almuslavish wants to merge 1 commit into
RiftCore00:devfrom
almuslavish:add-error-codes

Conversation

@almuslavish

Copy link
Copy Markdown

closes #179

Update Complete
✅ Added src/errors.js exporting:

INVALID_JSON
VALIDATION_ERROR
RATE_LIMITED
ROOM_FULL
AUTH_FAILED
✅ Updated src/server.js:

Added sendError(ws, message, code) helper
Error frames now include payload: { message, code }
Validation failures now send code from validateMessage
✅ Updated src/validator.js:

Returns code: INVALID_JSON for malformed JSON
Returns code: VALIDATION_ERROR for schema and freshness failures
✅ Updated tests/server.test.js:

Added imports for error constants
Asserted error frames include code
Added a malformed payload validation error test
✅ Updated README.md:

Documented server-to-client error frame payload
Listed supported error codes
No lint or syntax errors were reported in the edited files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add structured error codes to all server-to-client error frames

1 participant