Skip to content

Commit cc37eae

Browse files
authored
feat: add error schema type on EndpointOptions (#37)
1 parent d2cc324 commit cc37eae

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/endpoint.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ export interface EndpointOptions {
3232
* Query Schema
3333
*/
3434
query?: StandardSchemaV1;
35+
/**
36+
* Error Schema
37+
*/
38+
error?: StandardSchemaV1;
3539
/**
3640
* If true headers will be required to be passed in the context
3741
*/

src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export async function getBody(request: Request) {
5353
return await request.text();
5454
}
5555

56-
export function isAPIError(error: any) {
56+
export function isAPIError(error: any): error is APIError {
5757
return error instanceof APIError || error?.name === "APIError";
5858
}
5959

0 commit comments

Comments
 (0)