fix(editor): Add optional chaining to error handler (no-changelog) (#11500)

This commit is contained in:
Alex Grozav 2024-11-05 13:02:55 +02:00 committed by GitHub
parent 8b398256a8
commit 1f25e8e096
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -113,8 +113,8 @@ export async function request(config: {
});
}
const errorResponseData = error.response.data;
if (errorResponseData !== undefined && errorResponseData.message !== undefined) {
const errorResponseData = error.response?.data;
if (errorResponseData?.message !== undefined) {
if (errorResponseData.name === 'NodeApiError') {
errorResponseData.httpStatusCode = error.response.status;
throw errorResponseData;