add more logging in /explore

pull/185/head
Sven Sauleau 2023-02-03 16:11:07 +00:00
rodzic 96f688dfa1
commit 64f0984813
1 zmienionych plików z 11 dodań i 5 usunięć

Wyświetl plik

@ -6,11 +6,17 @@ import type { MastodonStatus } from '~/types'
export const statusesLoader = loader$<{ DATABASE: D1Database; domain: string }, Promise<MastodonStatus[]>>(
async ({ platform }) => {
// TODO: use the "trending" API endpoint here.
const response = await timelines.handleRequest(platform.domain, platform.DATABASE)
const results = await response.text()
// Manually parse the JSON to ensure that Qwik finds the resulting objects serializable.
return JSON.parse(results) as MastodonStatus[]
try {
// TODO: use the "trending" API endpoint here.
const response = await timelines.handleRequest(platform.domain, platform.DATABASE)
const results = await response.text()
// Manually parse the JSON to ensure that Qwik finds the resulting objects serializable.
return JSON.parse(results) as MastodonStatus[]
} catch (err: Error & { stack: string }) {
// eslint-disable-next-line no-console
console.log(err.stack, err.cause)
return []
}
}
)