How to use the pebble.PblAnalytics.cmd_fail_evt function in Pebble

To help you get started, we’ve selected a few Pebble examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Hexxeh / libpebble / pebble.py View on Github external
def run_action(self, action, args):
        # Find the extension that was called
        command = [x for x in self.commands if x.name == args.command][0]

        try:
            retval = command.run(args)
            if retval:
                PblAnalytics.cmd_fail_evt(args.command, 'unknown error')
            else:
                cmdName = args.command
                if cmdName == 'install' and args.logs is True:
                    cmdName = 'install --logs'
                PblAnalytics.cmd_success_evt(cmdName)
            return retval
                
        except libpebble.PebbleError as e:
            PblAnalytics.cmd_fail_evt(args.command, 'pebble error')
            if args.debug:
                raise e
            else:
                logging.error(e)
                return 1
            
        except ConfigurationException as e:
github Hexxeh / libpebble / pebble.py View on Github external
except NoCompilerException as e:
            PblAnalytics.missing_tools_evt()
            logging.error("The compiler/linker tools could not be found. "
                          "Ensure that the arm-cs-tools directory is present "
                          "in the Pebble SDK directory (%s)" % 
                          PblCommand().sdk_path(args))
            return 1
        
        except BuildErrorException as e:
            PblAnalytics.cmd_fail_evt(args.command, 'compilation error')
            logging.error("A compilation error occurred")
            return 1
        
        except AppTooBigException as e:
            PblAnalytics.cmd_fail_evt(args.command, 'application too big')
            logging.error("The built application is too big")
            return 1
        
        except Exception as e:
            PblAnalytics.cmd_fail_evt(args.command, 'unhandled exception: %s' %
                                 str(e))
            logging.error(str(e))
            return 1
github Hexxeh / libpebble / pebble.py View on Github external
cmdName = args.command
                if cmdName == 'install' and args.logs is True:
                    cmdName = 'install --logs'
                PblAnalytics.cmd_success_evt(cmdName)
            return retval
                
        except libpebble.PebbleError as e:
            PblAnalytics.cmd_fail_evt(args.command, 'pebble error')
            if args.debug:
                raise e
            else:
                logging.error(e)
                return 1
            
        except ConfigurationException as e:
            PblAnalytics.cmd_fail_evt(args.command, 'configuration error')
            logging.error(e)
            return 1
        
        except InvalidProjectException as e:
            PblAnalytics.cmd_fail_evt(args.command, 'invalid project')
            logging.error("This command must be run from a Pebble project "
                          "directory")
            return 1
        
        except OutdatedProjectException as e:
            PblAnalytics.cmd_fail_evt(args.command, 'outdated project')
            logging.error("The Pebble project directory is using an outdated "
                          "version of the SDK!")
            logging.error("Try running `pebble convert-project` to update the "
                          "project")
            return 1
github Hexxeh / libpebble / pebble.py View on Github external
# Find the extension that was called
        command = [x for x in self.commands if x.name == args.command][0]

        try:
            retval = command.run(args)
            if retval:
                PblAnalytics.cmd_fail_evt(args.command, 'unknown error')
            else:
                cmdName = args.command
                if cmdName == 'install' and args.logs is True:
                    cmdName = 'install --logs'
                PblAnalytics.cmd_success_evt(cmdName)
            return retval
                
        except libpebble.PebbleError as e:
            PblAnalytics.cmd_fail_evt(args.command, 'pebble error')
            if args.debug:
                raise e
            else:
                logging.error(e)
                return 1
            
        except ConfigurationException as e:
            PblAnalytics.cmd_fail_evt(args.command, 'configuration error')
            logging.error(e)
            return 1
        
        except InvalidProjectException as e:
            PblAnalytics.cmd_fail_evt(args.command, 'invalid project')
            logging.error("This command must be run from a Pebble project "
                          "directory")
            return 1
github Hexxeh / libpebble / pebble.py View on Github external
except libpebble.PebbleError as e:
            PblAnalytics.cmd_fail_evt(args.command, 'pebble error')
            if args.debug:
                raise e
            else:
                logging.error(e)
                return 1
            
        except ConfigurationException as e:
            PblAnalytics.cmd_fail_evt(args.command, 'configuration error')
            logging.error(e)
            return 1
        
        except InvalidProjectException as e:
            PblAnalytics.cmd_fail_evt(args.command, 'invalid project')
            logging.error("This command must be run from a Pebble project "
                          "directory")
            return 1
        
        except OutdatedProjectException as e:
            PblAnalytics.cmd_fail_evt(args.command, 'outdated project')
            logging.error("The Pebble project directory is using an outdated "
                          "version of the SDK!")
            logging.error("Try running `pebble convert-project` to update the "
                          "project")
            return 1
        
        except NoCompilerException as e:
            PblAnalytics.missing_tools_evt()
            logging.error("The compiler/linker tools could not be found. "
                          "Ensure that the arm-cs-tools directory is present "
github Hexxeh / libpebble / pebble.py View on Github external
logging.error(e)
                return 1
            
        except ConfigurationException as e:
            PblAnalytics.cmd_fail_evt(args.command, 'configuration error')
            logging.error(e)
            return 1
        
        except InvalidProjectException as e:
            PblAnalytics.cmd_fail_evt(args.command, 'invalid project')
            logging.error("This command must be run from a Pebble project "
                          "directory")
            return 1
        
        except OutdatedProjectException as e:
            PblAnalytics.cmd_fail_evt(args.command, 'outdated project')
            logging.error("The Pebble project directory is using an outdated "
                          "version of the SDK!")
            logging.error("Try running `pebble convert-project` to update the "
                          "project")
            return 1
        
        except NoCompilerException as e:
            PblAnalytics.missing_tools_evt()
            logging.error("The compiler/linker tools could not be found. "
                          "Ensure that the arm-cs-tools directory is present "
                          "in the Pebble SDK directory (%s)" % 
                          PblCommand().sdk_path(args))
            return 1
        
        except BuildErrorException as e:
            PblAnalytics.cmd_fail_evt(args.command, 'compilation error')
github Hexxeh / libpebble / pebble.py View on Github external
"in the Pebble SDK directory (%s)" % 
                          PblCommand().sdk_path(args))
            return 1
        
        except BuildErrorException as e:
            PblAnalytics.cmd_fail_evt(args.command, 'compilation error')
            logging.error("A compilation error occurred")
            return 1
        
        except AppTooBigException as e:
            PblAnalytics.cmd_fail_evt(args.command, 'application too big')
            logging.error("The built application is too big")
            return 1
        
        except Exception as e:
            PblAnalytics.cmd_fail_evt(args.command, 'unhandled exception: %s' %
                                 str(e))
            logging.error(str(e))
            return 1