adds error logging for recommend api
This commit is contained in:
@@ -3,6 +3,7 @@ import type { Trail } from '$lib/models/trail';
|
|||||||
import { pb } from '$lib/pocketbase';
|
import { pb } from '$lib/pocketbase';
|
||||||
import { handleError } from '$lib/util/api_util';
|
import { handleError } from '$lib/util/api_util';
|
||||||
import { error, json, type RequestEvent } from '@sveltejs/kit';
|
import { error, json, type RequestEvent } from '@sveltejs/kit';
|
||||||
|
import { ClientResponseError } from 'pocketbase';
|
||||||
|
|
||||||
export async function GET(event: RequestEvent) {
|
export async function GET(event: RequestEvent) {
|
||||||
try {
|
try {
|
||||||
@@ -13,6 +14,12 @@ export async function GET(event: RequestEvent) {
|
|||||||
size: safeSearchParams.size?.toString() ?? ""
|
size: safeSearchParams.size?.toString() ?? ""
|
||||||
})));
|
})));
|
||||||
|
|
||||||
|
if (!r.ok) {
|
||||||
|
const response = await r.json()
|
||||||
|
console.error(response)
|
||||||
|
throw new ClientResponseError({ status: response.code, response })
|
||||||
|
}
|
||||||
|
|
||||||
const result: Trail[] = await r.json();
|
const result: Trail[] = await r.json();
|
||||||
|
|
||||||
for (const t of result) {
|
for (const t of result) {
|
||||||
|
|||||||
@@ -126,7 +126,7 @@
|
|||||||
{loading}>Login</Button
|
{loading}>Login</Button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
{#if env.PUBLIC_DISABLE_SIGNUP === "false"}
|
{#if env.PUBLIC_DISABLE_SIGNUP !== "true"}
|
||||||
<span
|
<span
|
||||||
>{$_("no-account")}
|
>{$_("no-account")}
|
||||||
<a class="text-blue-500 underline" href="/register"
|
<a class="text-blue-500 underline" href="/register"
|
||||||
|
|||||||
Reference in New Issue
Block a user