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 24, 2024
1 parent 45e4505 commit b0c1173
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions packages/connect/src/core/onCallFirmwareUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,17 +202,27 @@ 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 => {
// 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 which are around ~132 byteLength
if (res.byteLength < 200) {
throw ERRORS.TypedError('Runtime', 'Firmware binary is too small');
}

return res;
});
return res;
})
.then(res => {
postMessage(
createUiMessage(UI.FIRMWARE_PROGRESS, {
device: device.toMessageObject(),
operation: 'downloading',
progress: 100,
}),
);

return res;
});
};

const firmwareCheck = async (
Expand Down

0 comments on commit b0c1173

Please sign in to comment.