Skip to content

Commit

Permalink
Merge pull request balena-io#2430 from resin-io/fix-blockmap-checksum…
Browse files Browse the repository at this point in the history
…-error

fix(writer): Set EVALIDATION on blockmap checksum errors
  • Loading branch information
thundron committed Aug 6, 2018
2 parents df76939 + 9eb3eea commit 8c870f2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/sdk/writer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})

Expand Down

0 comments on commit 8c870f2

Please sign in to comment.