forked from noxious/server
#233: Replaced all console logs, thrown errors with logger API
This commit is contained in:
@ -6,6 +6,7 @@ import { writeFile, mkdir } from 'node:fs/promises'
|
||||
import sharp from 'sharp'
|
||||
import { getPublicPath } from '../../../../utilities/storage'
|
||||
import CharacterRepository from '../../../../repositories/characterRepository'
|
||||
import { gameMasterLogger } from '../../../../utilities/logger'
|
||||
|
||||
type SpriteActionInput = Omit<SpriteAction, 'id' | 'spriteId' | 'frameWidth' | 'frameHeight'> & {
|
||||
sprites: string[]
|
||||
@ -60,11 +61,11 @@ export default class SpriteUpdateEvent {
|
||||
try {
|
||||
const parsed = JSON.parse(JSON.stringify(spriteActions)) as SpriteActionInput[]
|
||||
if (!Array.isArray(parsed)) {
|
||||
throw new Error('spriteActions is not an array')
|
||||
gameMasterLogger.error('Error parsing spriteActions: spriteActions is not an array')
|
||||
}
|
||||
return parsed
|
||||
} catch (error) {
|
||||
console.error('Error parsing spriteActions:', error)
|
||||
gameMasterLogger.error('Error parsing spriteActions:', error)
|
||||
throw error
|
||||
}
|
||||
}
|
||||
@ -75,7 +76,7 @@ export default class SpriteUpdateEvent {
|
||||
const { action, sprites } = spriteAction
|
||||
|
||||
if (!Array.isArray(sprites) || sprites.length === 0) {
|
||||
throw new Error(`Invalid sprites array for action: ${action}`)
|
||||
gameMasterLogger.error(`Invalid sprites array for action: ${action}`)
|
||||
}
|
||||
|
||||
const buffersWithDimensions = await Promise.all(
|
||||
|
Reference in New Issue
Block a user