diff --git a/grafana-plugin/src/utils/faro.ts b/grafana-plugin/src/utils/faro.ts index c9212e95..782511aa 100644 --- a/grafana-plugin/src/utils/faro.ts +++ b/grafana-plugin/src/utils/faro.ts @@ -105,19 +105,19 @@ class BaseFaroHelper { this.faro?.api.pushEvent(name, { url: res?.config?.url, status: `${res?.status}`, - statusText: `${res.statusText}`, - method: res.config?.method.toUpperCase(), + statusText: `${res?.statusText}`, + method: res?.config?.method.toUpperCase(), }); }; - pushAxiosNetworkError = (res: AxiosResponse) => { - this.faro?.api.pushError(new Error(`Network error: ${res.status}`), { + pushAxiosNetworkError = (res?: AxiosResponse) => { + this.faro?.api.pushError(new Error(`Network error: ${res?.status}`), { context: { - url: res.config?.url, + url: res?.config?.url, type: 'network', data: `${safeJSONStringify(res.data)}`, - status: `${res.status}`, - statusText: `${res.statusText}`, + status: `${res?.status}`, + statusText: `${res?.statusText}`, timestamp: new Date().toUTCString(), }, });