Skip to content

Commit

Permalink
chore(connect): fw-update: add error message when binary is too small
Browse files Browse the repository at this point in the history
  • Loading branch information
mroz22 committed May 20, 2024
1 parent 6516c71 commit dd44cac
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions packages/connect/src/core/onCallFirmwareUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,26 @@ const getBinaryHelper = (
version: device.firmwareRelease.release.version,
btcOnly,
intermediaryVersion,
}).then(res => {
postMessage(
createUiMessage(UI.FIRMWARE_PROGRESS, {
device: device.toMessageObject(),
operation: 'downloading',
progress: 100,
}),
);
})
.then(res => {
console.log('res.byteLength', res.byteLength);

Check warning on line 207 in packages/connect/src/core/onCallFirmwareUpdate.ts

View workflow job for this annotation

GitHub Actions / Linting and formatting

Unexpected console statement
// suspiciously small binary. this typically happens when build does not have git lfs enabled and all
// you download here are some pointers to lfs objects
if (res.byteLength < 1000) {
throw ERRORS.TypedError('Runtime', 'Firmware binary is too small');
}
})
.then(res => {
postMessage(
createUiMessage(UI.FIRMWARE_PROGRESS, {
device: device.toMessageObject(),
operation: 'downloading',
progress: 100,
}),
);

return res;
});
return res;
});
};

const firmwareCheck = async (
Expand Down

0 comments on commit dd44cac

Please sign in to comment.