mirror of
https://github.com/IT4Change/gradido.git
synced 2026-02-06 09:56:05 +00:00
handle undefined case
This commit is contained in:
parent
6e1d12d3b8
commit
f54b4e67d1
@ -30,8 +30,11 @@ export class BinaryData {
|
|||||||
} else if (Buffer.isBuffer(input)) {
|
} else if (Buffer.isBuffer(input)) {
|
||||||
this.buf = input
|
this.buf = input
|
||||||
this.hex = input.toString('hex')
|
this.hex = input.toString('hex')
|
||||||
|
} else if (input === undefined) {
|
||||||
|
this.buf = Buffer.from('')
|
||||||
|
this.hex = ''
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Either valid hex string or Buffer expected')
|
throw new Error(`Either valid hex string or Buffer expected: ${input}`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user