mirror of
https://github.com/balena-io/etcher.git
synced 2025-07-24 03:36:36 +00:00
fix(writer): Set EVALIDATION on blockmap checksum errors
This patches validation errors coming form the `blockmap` module to have the `EVALIDATION` error code, in order to trigger the appropriate code paths and analytics. Change-type: patch Signed-off-by: Jonas Hermsmeier <jhermsmeier@gmail.com>
This commit is contained in:
parent
df769396b1
commit
9eb3eea3f1
@ -515,6 +515,12 @@ class ImageWriter extends EventEmitter {
|
||||
const pipeline = this._createVerifyPipeline(destination)
|
||||
|
||||
pipeline.on('error', (error) => {
|
||||
// NOTE: As the `blockmap` module doesn't set our custom error codes,
|
||||
// we need to patch `EVALIDATION` into a range checksum error here
|
||||
if (error.message && error.message.startsWith('Invalid checksum for range')) {
|
||||
error.code = 'EVALIDATION'
|
||||
this.emit('fail', { device: destination.device.device, error })
|
||||
}
|
||||
this.emit('error', error)
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user