diff --git a/index.html b/index.html
index 029b8ec7..01c674d4 100644
--- a/index.html
+++ b/index.html
@@ -198,6 +198,19 @@
delete window._load_page_timeout
if (window.TrackJS && window.TrackJS.isInstalled()) {
window.TrackJS.track(new Error('It took more than ' + timeout / 1000 + 's to load the page'))
+ window.console = {
+ error: () => {},
+ info: () => {},
+ log: () => {},
+ warn: () => {},
+ assert: () => {},
+ debug: () => {},
+ trace: () => {}
+ }
+ window.TrackJS = {
+ isInstalled: () => false,
+ track: () => {}
+ }
}
window.setTimeout(function () {
window.location.reload()
diff --git a/src/core/auth/AuthGuard.tsx b/src/core/auth/AuthGuard.tsx
index 74033ec4..1193561f 100644
--- a/src/core/auth/AuthGuard.tsx
+++ b/src/core/auth/AuthGuard.tsx
@@ -178,6 +178,10 @@ export function AuthGuard({ children }: PropsWithChildren) {
(error: AxiosError | Error) => {
if ((error as AxiosError)?.code !== 'ERR_CANCELED') {
if (window.TrackJS?.isInstalled()) {
+ const data = (error as AxiosError)?.response?.data
+ if (data) {
+ window.TrackJS.console.info(data)
+ }
window.TrackJS.track(error)
}
postHog.capture(PostHogEvent.Error, {
@@ -198,6 +202,7 @@ export function AuthGuard({ children }: PropsWithChildren) {
}
if ('isAxiosError' in error && error.isAxiosError && error.code !== 'ERR_CANCELED') {
if (window.TrackJS?.isInstalled()) {
+ window.TrackJS.console.info(error.response?.data ?? 'no data from server')
window.TrackJS.track(error)
}
postHog.capture(PostHogEvent.NetworkError, {
diff --git a/src/pages/panel/shared/utils/sendInventoryError.ts b/src/pages/panel/shared/utils/sendInventoryError.ts
index 9059b3dd..412c1703 100644
--- a/src/pages/panel/shared/utils/sendInventoryError.ts
+++ b/src/pages/panel/shared/utils/sendInventoryError.ts
@@ -57,6 +57,10 @@ export const sendInventoryError = ({
postHog: PostHog
}) => {
if (window.TrackJS?.isInstalled()) {
+ const data = error?.response?.data
+ if (data) {
+ window.TrackJS.console.info(data)
+ }
window.TrackJS.track(error)
}