fix(nuxt): align error in showError/createError with h3 (#25945)

This commit is contained in:
Damian Głowala 2024-02-26 17:31:35 +01:00 committed by GitHub
parent ff1bb56e3f
commit 12503658ed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,7 +13,10 @@ export interface NuxtError<DataT = unknown> extends H3Error<DataT> {}
/** @since 3.0.0 */
export const showError = <DataT = unknown>(
error: string | Error | Partial<NuxtError<DataT>>
error: string | Error | (Partial<NuxtError<DataT>> & {
status?: number;
statusText?: string;
})
) => {
const nuxtError = createError<DataT>(error)
@ -56,7 +59,10 @@ export const isNuxtError = <DataT = unknown>(
/** @since 3.0.0 */
export const createError = <DataT = unknown>(
error: string | Partial<NuxtError<DataT>>
error: string | Error | (Partial<NuxtError<DataT>> & {
status?: number;
statusText?: string;
})
) => {
const nuxtError: NuxtError<DataT> = createH3Error<DataT>(error)