src/specter.py
async def handle_exception(self, exception, next_fn):
        """
        Handle exception, show proper error message
        and return next function to call and await
        """
        self.gui.hide_loader()
        try:
            raise exception
        except CriticalErrorWipeImmediately as e:
            # show error
            await self.gui.error("Critical error, the device will be wiped.\n\n%s" % e)
            self.gui.show_loader(title="Wiping the device...")
            # wipe everything and reboot
            self.wipe()
        # catch an expected error
        except BaseError as e:
            # show error
            await self.gui.alert(e.NAME, "%s" % e)
            # restart
            return next_fn
        # show trace for unexpected errors
        except Exception as e:
            print(e)
            b = BytesIO()
            sys.print_exception(e, b)
            errmsg = "Something unexpected happened...\n\n"
            errmsg += b.getvalue().decode()
            await self.gui.error(errmsg)
            # restart
            return next_fn

        Handle exception, show proper error message
        and return next function to call and await
        
Handle exception, show proper error message
and return next function to call and await
Handle exception show proper error message and return next function to call and await
async def handle_exception(self, exception, next_fn):
        self.gui.hide_loader()
        try:
            raise exception
        except CriticalErrorWipeImmediately as e:
            await self.gui.error("Critical error, the device will be wiped.\n\n%s" % e)
            self.gui.show_loader(title="Wiping the device...")
            self.wipe()
        except BaseError as e:
            await self.gui.alert(e.NAME, "%s" % e)
            return next_fn
        except Exception as e:
            print(e)
            b = BytesIO()
            sys.print_exception(e, b)
            errmsg = "Something unexpected happened...\n\n"
            errmsg += b.getvalue().decode()
            await self.gui.error(errmsg)
            return next_fn
async def handle_exception ( self , exception , next_fn ) : self . gui . hide_loader ( ) try : raise exception except CriticalErrorWipeImmediately as e : await self . gui . error ( "Critical error, the device will be wiped.\n\n%s" % e ) self . gui . show_loader ( title = "Wiping the device..." ) self . wipe ( ) except BaseError as e : await self . gui . alert ( e . NAME , "%s" % e ) return next_fn except Exception as e : print ( e ) b = BytesIO ( ) sys . print_exception ( e , b ) errmsg = "Something unexpected happened...\n\n" errmsg += b . getvalue ( ) . decode ( ) await self . gui . error ( errmsg ) return next_fn
Handle exception, show proper error message
and return next function to call and await
Handle exception show proper error message and return next function to call and await
"""
        Handle exception, show proper error message
        and return next function to call and await
        """ # show error # wipe everything and reboot # catch an expected error # show error # restart # show trace for unexpected errors # restart
self
exception
next_fn