handle undefined case

This commit is contained in:
einhornimmond 2025-10-14 08:43:39 +02:00
parent 6e1d12d3b8
commit f54b4e67d1

View File

@ -30,8 +30,11 @@ export class BinaryData {
} else if (Buffer.isBuffer(input)) {
this.buf = input
this.hex = input.toString('hex')
} else if (input === undefined) {
this.buf = Buffer.from('')
this.hex = ''
} else {
throw new Error('Either valid hex string or Buffer expected')
throw new Error(`Either valid hex string or Buffer expected: ${input}`)
}
}