Skip to content

Instantly share code, notes, and snippets.

@stevgouws
Last active February 24, 2020 16:45
Show Gist options
  • Save stevgouws/bf6f255fcac8f193fa6dc7243e317acb to your computer and use it in GitHub Desktop.
Save stevgouws/bf6f255fcac8f193fa6dc7243e317acb to your computer and use it in GitHub Desktop.
function simpleGenericError(aborted) {
if (aborted) return;
const modalParams = {
title: translations.get("Something went wrong"),
message: translations.get(
"We couldn't contact the venue to complete the operation, please try again later."
),
isSimple: true,
options: [
{
label: translations.get("OK"),
},
],
};
$rootScope.$broadcast("FORCE_HIDE_PRELOADER");
$rootScope.$broadcast("EMPTY_BASKET");
$rootScope.$broadcast("HIDE_OVERLAY");
$rootScope.$broadcast("DISPLAY_MODAL", modalParams);
$rootScope.$broadcast("SEND_EVENT", { name: "HIDE_PRELOADER" });
}
// *************************************************************
// What's NOT commented out, is what's NOT in simpleGenericError
// *************************************************************
function genericError(error) {
if (error && error.constructor.name === "ManuallyAbortedError") return;
else if (error) self.logToSentry(error);
// $rootScope.$broadcast("FORCE_HIDE_PRELOADER");
// $rootScope.$broadcast("HIDE_OVERLAY");
// $rootScope.$broadcast("EMPTY_BASKET");
$rootScope.$broadcast("COLLAPSE_BASKET");
$rootScope.$broadcast("CLEAR_ALL_DATA");
$rootScope.$broadcast("CLEAR_SELECTED_PERFORMANCE");
$rootScope.$broadcast("ERROR");
// $rootScope.$broadcast("SEND_EVENT", { name: "HIDE_PRELOADER" });
// const modalParams = {
// title: translations.get("Something went wrong"),
// message: translations.get(
// "We couldn't contact the venue to complete the operation, please try again later."
// ),
// isSimple: true,
// options: [
// {
// label: translations.get("OK"),
// },
// ],
// };
analytics_event(appStateFlags.isSeatSelection, "generic error", "");
// $timeout(() => $rootScope.$emit("DISPLAY_MODAL", modalParams), 200);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment