mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-12-23 14:29:42 -05:00
move try/catch into main control flow and more from code review comments
This commit is contained in:
parent
4cdc8f344b
commit
5a9c3ad353
@ -17,6 +17,7 @@ class HeiiOnCall extends NotificationProvider {
|
|||||||
payload["url"] = baseURL + getMonitorRelativeURL(monitorJSON.id);
|
payload["url"] = baseURL + getMonitorRelativeURL(monitorJSON.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
if (!heartbeatJSON) {
|
if (!heartbeatJSON) {
|
||||||
// Testing or general notification like certificate expiry
|
// Testing or general notification like certificate expiry
|
||||||
payload["msg"] = msg;
|
payload["msg"] = msg;
|
||||||
@ -30,6 +31,10 @@ class HeiiOnCall extends NotificationProvider {
|
|||||||
if (heartbeatJSON.status === UP) {
|
if (heartbeatJSON.status === UP) {
|
||||||
return this.postNotification(notification, "resolve", payload);
|
return this.postNotification(notification, "resolve", payload);
|
||||||
}
|
}
|
||||||
|
} catch (error) {
|
||||||
|
this.throwGeneralAxiosError(error);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -49,15 +54,11 @@ class HeiiOnCall extends NotificationProvider {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Post to Heii On-Call Trigger https://heiioncall.com/docs#manual-triggers
|
// Post to Heii On-Call Trigger https://heiioncall.com/docs#manual-triggers
|
||||||
try {
|
|
||||||
await axios.post(
|
await axios.post(
|
||||||
`https://heiioncall.com/triggers/${notification.heiiOnCallTriggerId}/${action}`,
|
`https://heiioncall.com/triggers/${notification.heiiOnCallTriggerId}/${action}`,
|
||||||
payload,
|
payload,
|
||||||
config
|
config
|
||||||
);
|
);
|
||||||
} catch (error) {
|
|
||||||
this.throwGeneralAxiosError(error);
|
|
||||||
}
|
|
||||||
|
|
||||||
return "Sent Successfully";
|
return "Sent Successfully";
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
></HiddenInput>
|
></HiddenInput>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label for="heiioncall-trigger-id" class="form-label">{{ $t("Trigger ID") }}<span
|
<label for="heiioncall-trigger-id" class="form-label">Trigger ID<span
|
||||||
style="color: red;"
|
style="color: red;"
|
||||||
><sup>*</sup></span></label>
|
><sup>*</sup></span></label>
|
||||||
<HiddenInput
|
<HiddenInput
|
||||||
@ -17,11 +17,9 @@
|
|||||||
autocomplete="false"
|
autocomplete="false"
|
||||||
></HiddenInput>
|
></HiddenInput>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-text">
|
<i18n-t tag="p" keypath="wayToGetHeiiOnCallDetails" class="form-text mt-3">
|
||||||
<i18n-t tag="p" keypath="wayToGetHeiiOnCallDetails" style="margin-top: 8px;">
|
|
||||||
<a href="https://heiioncall.com/docs" target="_blank">{{ $t("documentationOf", ["Heii On-Call"]) }}</a>
|
<a href="https://heiioncall.com/docs" target="_blank">{{ $t("documentationOf", ["Heii On-Call"]) }}</a>
|
||||||
</i18n-t>
|
</i18n-t>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
@ -884,6 +884,6 @@
|
|||||||
"GrafanaOncallUrl": "Grafana Oncall URL",
|
"GrafanaOncallUrl": "Grafana Oncall URL",
|
||||||
"Browser Screenshot": "Browser Screenshot",
|
"Browser Screenshot": "Browser Screenshot",
|
||||||
"What is a Remote Browser?": "What is a Remote Browser?",
|
"What is a Remote Browser?": "What is a Remote Browser?",
|
||||||
"Trigger ID": "Trigger ID",
|
"wayToGetHeiiOnCallDetails": "How to get the Tigger ID and API Keys is explained in the {0}",
|
||||||
"wayToGetHeiiOnCallDetails": "How to get the Tigger ID and API Keys is explained in the {documentation}"
|
"documentationOf": "{0} Documentation"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user