File tree Expand file tree Collapse file tree 1 file changed +17
-2
lines changed
packages/frames.js/src/core Expand file tree Collapse file tree 1 file changed +17
-2
lines changed Original file line number Diff line number Diff line change 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+ */
15export 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+ */
715export 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+ */
1325export 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+
You can’t perform that action at this time.
0 commit comments