Fixed strings
This commit is contained in:
parent
89f8137dc3
commit
6b03937c39
@ -25,12 +25,13 @@ export abstract class BaseEvent {
|
|||||||
|
|
||||||
protected emitError(message: string): void {
|
protected emitError(message: string): void {
|
||||||
this.socket.emit('notification', { title: 'Server message', message })
|
this.socket.emit('notification', { title: 'Server message', message })
|
||||||
this.logger.error('character:connect error', `Player ${this.socket.userId}: ${message}`)
|
this.logger.error('Base event error', `Player ${this.socket.userId}: ${message}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
protected handleError(context: string, error: unknown): void {
|
protected handleError(context: string, error: unknown): void {
|
||||||
const errorMessage = error instanceof Error ? error.message : String(error)
|
console.log(error)
|
||||||
this.emitError(`${context}: ${errorMessage}`)
|
const errorMessage = error instanceof Error ? error.message : error && typeof error === 'object' && 'toString' in error ? error.toString() : String(error)
|
||||||
this.logger.error('character:connect error', errorMessage)
|
this.socket.emit('notification', { title: 'Server message', message: `Server error occured. Please contact the server administrator.` })
|
||||||
|
this.logger.error('Base event error', errorMessage)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user