forked from opentiny/tiny-engine
fix(err-monitor): stop monitoring if monitorurl not exist (#423)
* fix(err-monitor): stop monitoring if monitorurl not exist * fix(error-monitor): cancel request if url not exist
This commit is contained in:
parent
f7980d8c83
commit
da8f58b0d9
|
@ -24,7 +24,13 @@ const http = useHttp()
|
|||
* @param { json } params {"event_type": design_error,"url": "elit in reprehenderit enim incididunt" }
|
||||
* @returns { Promise }
|
||||
*/
|
||||
export const requestEvent = (url, params) => http.post(url, params).catch(() => {})
|
||||
export const requestEvent = (url, params) => {
|
||||
if (!url) {
|
||||
return
|
||||
}
|
||||
|
||||
return http.post(url, params).catch(() => {})
|
||||
}
|
||||
|
||||
/**
|
||||
* 页面更新
|
||||
|
|
|
@ -93,6 +93,10 @@ const promiseMonitoring = () => {
|
|||
*/
|
||||
|
||||
export const iframeMonitoring = () => {
|
||||
if (!monitorUrl) {
|
||||
return false
|
||||
}
|
||||
|
||||
window.frames[0].onerror = function (errorMessage, scriptURI, lineNo, columnNo, error) {
|
||||
requestEvent(monitorUrl, {
|
||||
event_type: 'design_iframeError',
|
||||
|
|
Loading…
Reference in New Issue