Merge pull request #185 from cloudflare/sven/more-logging

add more logging in /explore
pull/194/head
Sven Sauleau 2023-02-03 16:15:49 +00:00 zatwierdzone przez GitHub
commit 758eb91dfe
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
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 []
}
}
)