Browse Source

Always throw error when init fails (#244)

Paulus Schoutsen 3 years ago
parent
commit
5ac98c6193
1 changed files with 6 additions and 6 deletions
  1. 6 6
      src/flash.ts

+ 6 - 6
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;