Skip to content

Commit

Permalink
Create function to getErrorMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
RodriSanchez1 committed Aug 16, 2023
1 parent fbdc3ea commit 4a9532a
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,7 @@ export function updateIsSubscribed(requestOrigin = 'unkwnown') {
);
}
} catch (err) {
const errorMessage =
err.message +
'. ' +
(err.response ? err.response?.data?.message : err.error);

console.error(errorMessage);
console.error(getErrorMessage(err));

isSubscribed = false;
status = NOT_SUBSCRIBED;
Expand Down Expand Up @@ -206,6 +201,14 @@ export function updateIsSubscribed(requestOrigin = 'unkwnown') {
}
return isSubscribed;
};

function getErrorMessage(err) {
return (
err.message +
'. ' +
(err.response ? err.response?.data?.message : err.error)
);
}
}

export function updatePlans() {
Expand Down

0 comments on commit 4a9532a

Please sign in to comment.