mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
Log error
This commit is contained in:
@@ -13,7 +13,6 @@ const getCheckout: CheckoutEndpoint['handlers']['getCheckout'] = async ({
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
// Register credit card
|
// Register credit card
|
||||||
const payments = await restFetch(
|
const payments = await restFetch(
|
||||||
'GET',
|
'GET',
|
||||||
@@ -32,20 +31,6 @@ const getCheckout: CheckoutEndpoint['handlers']['getCheckout'] = async ({
|
|||||||
},
|
},
|
||||||
errors: [],
|
errors: [],
|
||||||
})
|
})
|
||||||
} catch (error: any) {
|
|
||||||
console.log(error, error.toString(), JSON.stringify(error))
|
|
||||||
|
|
||||||
// Return cart and errors
|
|
||||||
res.status(500).json({
|
|
||||||
data: null,
|
|
||||||
errors: [
|
|
||||||
{
|
|
||||||
message: error.message,
|
|
||||||
code: error.statusCode || error.code || error.status,
|
|
||||||
},
|
|
||||||
],
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getCheckout
|
export default getCheckout
|
||||||
|
@@ -95,12 +95,12 @@ export async function fetchData<T>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the body of it
|
// Get the body of it
|
||||||
const error = await dataResponse.json()
|
const error = await dataResponse.textConverted()
|
||||||
|
|
||||||
// And return an error
|
// And return an error
|
||||||
throw new FetcherError({
|
throw new FetcherError({
|
||||||
errors: [{ message: error.error_description.Code }],
|
errors: [{ message: error || dataResponse.statusText }],
|
||||||
status: error.error_description.HttpStatus,
|
status: dataResponse.status,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user