Always throw error when init fails (#244)

This commit is contained in:
Paulus Schoutsen 2022-05-31 14:14:23 -07:00 committed by GitHub
parent 63e097eb78
commit 5ac98c6193
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -48,13 +48,13 @@ export const flash = async (
await esploader.initialize(); await esploader.initialize();
} catch (err: any) { } catch (err: any) {
logger.error(err); logger.error(err);
if (esploader.connected) {
fireStateEvent({ fireStateEvent({
state: FlashStateType.ERROR, state: FlashStateType.ERROR,
message: message:
"Failed to initialize. Try resetting your device or holding the BOOT button while clicking INSTALL.", "Failed to initialize. Try resetting your device or holding the BOOT button while clicking INSTALL.",
details: { error: FlashError.FAILED_INITIALIZING, details: err }, details: { error: FlashError.FAILED_INITIALIZING, details: err },
}); });
if (esploader.connected) {
await esploader.disconnect(); await esploader.disconnect();
} }
return; return;