mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
feat: show error going to report in console if not in production enviroment
This commit is contained in:
parent
e52d34b74f
commit
eed111e2aa
1 changed files with 11 additions and 9 deletions
|
|
@ -32,13 +32,15 @@ function encodeParams<
|
|||
}
|
||||
|
||||
function reportError(error: Error) {
|
||||
if (!IN_PRODUCTION_MODE) return
|
||||
return fetch(
|
||||
`${LOG_ENDPOINT}?${encodeParams({
|
||||
stack: error.stack,
|
||||
error: (error && error.message) || error,
|
||||
path: window.location.href,
|
||||
version,
|
||||
})}`,
|
||||
)
|
||||
const reportBody = {
|
||||
stack: error.stack,
|
||||
error: (error && error.message) || error,
|
||||
path: window.location.href,
|
||||
version,
|
||||
}
|
||||
if (!IN_PRODUCTION_MODE) {
|
||||
console.error(reportBody)
|
||||
return
|
||||
}
|
||||
return fetch(`${LOG_ENDPOINT}?${encodeParams(reportBody)}`)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue