Function handleError

Handles errors by logging them and displaying an alert message.

export const handleError = function (alert, t) {
return function (error) {
console.error(error);
if (error.error?.toString() === "406") {
alert.error(t(error.reason));
} else {
alert.error(t("supra.errors.standardError"));
}
};
};
  • Parameters

    • alert: any

      Alert object with an error method to display notifications.

    • t: Function

      Translation function to convert error messages into user-friendly text.

    Returns Function

    • A function that takes an error object and processes it.