Prevent sending log error to server on 404
This commit is contained in:
parent
ded68a9760
commit
d522369bed
|
@ -87,7 +87,11 @@ export class RestExtractor {
|
|||
|
||||
if (err.status !== undefined) {
|
||||
const errorMessage = this.buildServerErrorMessage(err)
|
||||
logger.error(`Backend returned code ${err.status}, errorMessage is: ${errorMessage}`)
|
||||
|
||||
const message = `Backend returned code ${err.status}, errorMessage is: ${errorMessage}`
|
||||
|
||||
if (err.status === HttpStatusCode.NOT_FOUND_404) logger.clientError(message)
|
||||
else logger.error(message)
|
||||
|
||||
return errorMessage
|
||||
}
|
||||
|
|
|
@ -27,6 +27,10 @@ class Logger {
|
|||
warn (message: LoggerMessage, meta?: LoggerMeta) {
|
||||
this.runHooks('warn', message, meta)
|
||||
|
||||
this.clientWarn(message, meta)
|
||||
}
|
||||
|
||||
clientWarn (message: LoggerMessage, meta?: LoggerMeta) {
|
||||
if (meta) console.warn(message, meta)
|
||||
else console.warn(message)
|
||||
}
|
||||
|
@ -34,6 +38,10 @@ class Logger {
|
|||
error (message: LoggerMessage, meta?: LoggerMeta) {
|
||||
this.runHooks('error', message, meta)
|
||||
|
||||
this.clientError(message, meta)
|
||||
}
|
||||
|
||||
clientError (message: LoggerMessage, meta?: LoggerMeta) {
|
||||
if (meta) console.error(message, meta)
|
||||
else console.error(message)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue