Skip to content

Commit fc8173c

Browse files
fix lint errors
1 parent 76e5270 commit fc8173c

File tree

6 files changed

+10
-6
lines changed

6 files changed

+10
-6
lines changed

src/pages/api/[version].ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const GET: APIRoute = async ({ params, url }) => {
2525
return createJsonResponse(sections)
2626
} catch (error) {
2727
return createJsonResponse(
28-
{ error: 'Failed to load API index' },
28+
{ error: 'Failed to load API index', details: error },
2929
500
3030
)
3131
}

src/pages/api/[version]/[section].ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const GET: APIRoute = async ({ params, url }) => {
2929
return createJsonResponse(pages)
3030
} catch (error) {
3131
return createJsonResponse(
32-
{ error: 'Failed to load API index' },
32+
{ error: 'Failed to load API index', details: error },
3333
500
3434
)
3535
}

src/pages/api/[version]/[section]/[page].ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export const GET: APIRoute = async ({ params, url }) => {
3131
return createJsonResponse(tabs)
3232
} catch (error) {
3333
return createJsonResponse(
34-
{ error: 'Failed to load API index' },
34+
{ error: 'Failed to load API index', details: error },
3535
500
3636
)
3737
}

src/pages/api/openapi.json.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { APIRoute } from 'astro'
22
import { fetchApiIndex } from '../../utils/apiIndex/fetch'
3+
import { createJsonResponse } from '../../utils/apiHelpers'
34

45
export const prerender = false
56

@@ -9,7 +10,10 @@ export const GET: APIRoute = async ({ url }) => {
910
const index = await fetchApiIndex(url)
1011
versions = index.versions
1112
} catch (error) {
12-
versions = []
13+
return createJsonResponse(
14+
{ error: 'Failed to load API index', details: error },
15+
500
16+
)
1317
}
1418

1519
const openApiSpec = {

src/pages/api/versions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const GET: APIRoute = async ({ url }) => {
1010
return createJsonResponse(index.versions)
1111
} catch (error) {
1212
return createJsonResponse(
13-
{ error: 'Failed to load API index' },
13+
{ error: 'Failed to load API index', details: error },
1414
500
1515
)
1616
}

src/pages/apiIndex.json.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export const GET: APIRoute = async () => {
1515
})
1616
} catch (error) {
1717
return new Response(
18-
JSON.stringify({ error: 'Failed to load API index' }),
18+
JSON.stringify({ error: 'Failed to load API index', details: error }),
1919
{
2020
status: 500,
2121
headers: {

0 commit comments

Comments
 (0)