From 5ac98c6193064c6f7f4328e350b9aa2ab812f43f Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 31 May 2022 14:14:23 -0700 Subject: [PATCH] Always throw error when init fails (#244) --- src/flash.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/flash.ts b/src/flash.ts index 720d4f0..2e7b96e 100644 --- a/src/flash.ts +++ b/src/flash.ts @@ -48,13 +48,13 @@ export const flash = async ( await esploader.initialize(); } catch (err: any) { logger.error(err); + fireStateEvent({ + state: FlashStateType.ERROR, + message: + "Failed to initialize. Try resetting your device or holding the BOOT button while clicking INSTALL.", + details: { error: FlashError.FAILED_INITIALIZING, details: err }, + }); if (esploader.connected) { - fireStateEvent({ - state: FlashStateType.ERROR, - message: - "Failed to initialize. Try resetting your device or holding the BOOT button while clicking INSTALL.", - details: { error: FlashError.FAILED_INITIALIZING, details: err }, - }); await esploader.disconnect(); } return;