Skip to content

Commit 732d26b

Browse files
committed
feat: onError handler
1 parent 77aa9da commit 732d26b

File tree

12 files changed

+469
-310
lines changed

12 files changed

+469
-310
lines changed
Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
11
import {_GET, _POST} from "../../../generated/todo-lists.yaml/attachments/route"
22

3-
export const GET = _GET(async (respond, request) => {
4-
// TODO: implementation
5-
return respond.withStatus(501).body({message: "not implemented"} as any)
6-
})
7-
export const POST = _POST(async ({body}, respond, request) => {
8-
// TODO: implementation
9-
return respond.withStatus(501).body({message: "not implemented"} as any)
10-
})
3+
export const GET = _GET(
4+
async (respond, request) => {
5+
// TODO: implementation
6+
return respond.withStatus(501).body({message: "not implemented"} as any)
7+
},
8+
async (err) => {
9+
// TODO: implementation
10+
return new Response(JSON.stringify({message: "not implemented"}), {
11+
status: 501,
12+
})
13+
},
14+
)
15+
export const POST = _POST(
16+
async ({body}, respond, request) => {
17+
// TODO: implementation
18+
return respond.withStatus(501).body({message: "not implemented"} as any)
19+
},
20+
async (err) => {
21+
// TODO: implementation
22+
return new Response(JSON.stringify({message: "not implemented"}), {
23+
status: 501,
24+
})
25+
},
26+
)

integration-tests/typescript-nextjs/src/app/todo-lists.yaml/list/[listId]/items/route.ts

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,27 @@ import {
33
_POST,
44
} from "../../../../../generated/todo-lists.yaml/list/[listId]/items/route"
55

6-
export const GET = _GET(async ({params}, respond, request) => {
7-
// TODO: implementation
8-
return respond.withStatus(501).body({message: "not implemented"} as any)
9-
})
10-
export const POST = _POST(async ({params, body}, respond, request) => {
11-
// TODO: implementation
12-
return respond.withStatus(501).body({message: "not implemented"} as any)
13-
})
6+
export const GET = _GET(
7+
async ({params}, respond, request) => {
8+
// TODO: implementation
9+
return respond.withStatus(501).body({message: "not implemented"} as any)
10+
},
11+
async (err) => {
12+
// TODO: implementation
13+
return new Response(JSON.stringify({message: "not implemented"}), {
14+
status: 501,
15+
})
16+
},
17+
)
18+
export const POST = _POST(
19+
async ({params, body}, respond, request) => {
20+
// TODO: implementation
21+
return respond.withStatus(501).body({message: "not implemented"} as any)
22+
},
23+
async (err) => {
24+
// TODO: implementation
25+
return new Response(JSON.stringify({message: "not implemented"}), {
26+
status: 501,
27+
})
28+
},
29+
)

integration-tests/typescript-nextjs/src/app/todo-lists.yaml/list/[listId]/route.ts

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,39 @@ import {
44
_PUT,
55
} from "../../../../generated/todo-lists.yaml/list/[listId]/route"
66

7-
export const GET = _GET(async ({params}, respond, request) => {
8-
// TODO: implementation
9-
return respond.withStatus(501).body({message: "not implemented"} as any)
10-
})
11-
export const PUT = _PUT(async ({params, body}, respond, request) => {
12-
// TODO: implementation
13-
return respond.withStatus(501).body({message: "not implemented"} as any)
14-
})
15-
export const DELETE = _DELETE(async ({params}, respond, request) => {
16-
// TODO: implementation
17-
return respond.withStatus(501).body({message: "not implemented"} as any)
18-
})
7+
export const GET = _GET(
8+
async ({params}, respond, request) => {
9+
// TODO: implementation
10+
return respond.withStatus(501).body({message: "not implemented"} as any)
11+
},
12+
async (err) => {
13+
// TODO: implementation
14+
return new Response(JSON.stringify({message: "not implemented"}), {
15+
status: 501,
16+
})
17+
},
18+
)
19+
export const PUT = _PUT(
20+
async ({params, body}, respond, request) => {
21+
// TODO: implementation
22+
return respond.withStatus(501).body({message: "not implemented"} as any)
23+
},
24+
async (err) => {
25+
// TODO: implementation
26+
return new Response(JSON.stringify({message: "not implemented"}), {
27+
status: 501,
28+
})
29+
},
30+
)
31+
export const DELETE = _DELETE(
32+
async ({params}, respond, request) => {
33+
// TODO: implementation
34+
return respond.withStatus(501).body({message: "not implemented"} as any)
35+
},
36+
async (err) => {
37+
// TODO: implementation
38+
return new Response(JSON.stringify({message: "not implemented"}), {
39+
status: 501,
40+
})
41+
},
42+
)
Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
import {_GET} from "../../../generated/todo-lists.yaml/list/route"
22

3-
export const GET = _GET(async ({query}, respond, request) => {
4-
// TODO: implementation
5-
return respond.withStatus(501).body({message: "not implemented"} as any)
6-
})
3+
export const GET = _GET(
4+
async ({query}, respond, request) => {
5+
// TODO: implementation
6+
return respond.withStatus(501).body({message: "not implemented"} as any)
7+
},
8+
async (err) => {
9+
// TODO: implementation
10+
return new Response(JSON.stringify({message: "not implemented"}), {
11+
status: 501,
12+
})
13+
},
14+
)

integration-tests/typescript-nextjs/src/generated/todo-lists.yaml/attachments/route.ts

Lines changed: 66 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration-tests/typescript-nextjs/src/generated/todo-lists.yaml/clients/client.ts renamed to integration-tests/typescript-nextjs/src/generated/todo-lists.yaml/client.ts

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)