feat: add parsable error handling to api methods

This commit is contained in:
mrjvs
2026-08-11 20:31:42 +02:00
parent f98a244606
commit 95cefec5c2
12 changed files with 128 additions and 37 deletions

10
src/composables/errors.ts Normal file
View File

@@ -0,0 +1,10 @@
import { FetchError } from 'ofetch';
import { getApiError as baseGetApiError } from '~~/shared/errors';
import type { ApiError } from '~~/shared/errors';
export function getApiError(error: any): ApiError {
if (error instanceof FetchError) {
return baseGetApiError(error.data);
}
return baseGetApiError(error);
}