Skip to content

Commit 2971431

Browse files
committed
docs(core): add JSDoc documentation to error classes
1 parent 633c33d commit 2971431

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed
Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,36 @@
1+
/**
2+
* Error thrown when the request body cannot be parsed as JSON.
3+
* This typically occurs when the frame action payload is malformed.
4+
*/
15
export class RequestBodyNotJSONError extends Error {
26
constructor() {
37
super("Invalid frame action payload, request body is not JSON");
48
}
59
}
610

11+
/**
12+
* Error thrown when the frame action payload is invalid.
13+
* This occurs when the payload doesn't contain the expected structure.
14+
*/
715
export class InvalidFrameActionPayloadError extends Error {
816
constructor(message = "Invalid frame action payload") {
917
super(message);
1018
}
1119
}
1220

21+
/**
22+
* Error class for frame message validation errors.
23+
* Used to return user-facing error messages with appropriate HTTP status codes.
24+
*/
1325
export class FrameMessageError extends Error {
1426
status: number;
1527

1628
/**
17-
*
29+
* Creates a new FrameMessageError.
1830
* @param message - Message to show the user (up to 90 characters)
19-
* @param status - 4XX status code
31+
* @param status - HTTP status code (must be 4XX)
32+
* @throws Error if message exceeds 90 characters
33+
* @throws Error if status code is not in 4XX range
2034
*/
2135
constructor(message: string, status: number) {
2236
if (message.length > 90) throw new Error("Message too long");
@@ -26,3 +40,4 @@ export class FrameMessageError extends Error {
2640
this.status = status;
2741
}
2842
}
43+

0 commit comments

Comments
 (0)