Merge pull request #159 from UniversityRadioYork/markspolakovs-update-failure-raygun

Report showplan save failures to Raygun
This commit is contained in:
Marks Polakovs 2020-10-08 23:04:43 +01:00 committed by GitHub
commit 24263ea407
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,6 +3,7 @@ import * as api from "../api";
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
import { AppThunk } from "../store";
import { cloneDeep } from "lodash";
import raygun from "raygun4js";
export interface ItemGhost {
type: "ghost";
@ -320,6 +321,13 @@ export const moveItem = (
if (getState().settings.saveShowPlanChanges) {
const result = await api.updateShowplan(timeslotid, ops);
if (!result.every((x) => x.status)) {
raygun("send", {
error: new Error("Showplan update failure [moveItem]"),
customData: {
ops,
result,
},
});
dispatch(showplan.actions.planSaveError("Failed to update show plan."));
return;
}
@ -393,6 +401,13 @@ export const addItem = (
});
const result = await api.updateShowplan(timeslotId, ops);
if (!result.every((x) => x.status)) {
raygun("send", {
error: new Error("Showplan update failure [addItem]"),
customData: {
ops,
result,
},
});
dispatch(showplan.actions.planSaveError("Failed to update show plan."));
return;
}
@ -449,6 +464,13 @@ export const removeItem = (
if (getState().settings.saveShowPlanChanges) {
const result = await api.updateShowplan(timeslotId, ops);
if (!result.every((x) => x.status)) {
raygun("send", {
error: new Error("Showplan update failure [removeItem]"),
customData: {
ops,
result,
},
});
dispatch(showplan.actions.planSaveError("Failed to update show plan."));
return;
}