mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-06 23:40:29 +03:00
Don't use generic Exception raises
That hides bugs, since all exceptions (including bugs that cause raises that weren't our doing) fall under the "Exception" except
This commit is contained in:
parent
b56360512c
commit
ff06694adc
5 changed files with 22 additions and 22 deletions
|
|
@ -25,7 +25,7 @@ from optparse import OptionParser, OptionError
|
|||
import logging
|
||||
|
||||
import common
|
||||
from common import FDroidPopen
|
||||
from common import FDroidPopen, FDroidException
|
||||
|
||||
options = None
|
||||
config = None
|
||||
|
|
@ -34,7 +34,7 @@ config = None
|
|||
def devices():
|
||||
p = FDroidPopen([config['adb'], "devices"])
|
||||
if p.returncode != 0:
|
||||
raise Exception("An error occured when finding devices: %s" % p.output)
|
||||
raise FDroidException("An error occured when finding devices: %s" % p.output)
|
||||
lines = p.output.splitlines()
|
||||
if lines[0].startswith('* daemon not running'):
|
||||
lines = lines[2:]
|
||||
|
|
@ -85,7 +85,7 @@ def main():
|
|||
|
||||
for appid, apk in apks.iteritems():
|
||||
if not apk:
|
||||
raise Exception("No signed apk available for %s" % appid)
|
||||
raise FDroidException("No signed apk available for %s" % appid)
|
||||
|
||||
else:
|
||||
|
||||
|
|
@ -96,7 +96,7 @@ def main():
|
|||
# Get device list each time to avoid device not found errors
|
||||
devs = devices()
|
||||
if not devs:
|
||||
raise Exception("No attached devices found")
|
||||
raise FDroidException("No attached devices found")
|
||||
logging.info("Installing %s..." % apk)
|
||||
for dev in devs:
|
||||
logging.info("Installing %s on %s..." % (apk, dev))
|
||||
|
|
@ -111,7 +111,7 @@ def main():
|
|||
if fail == "INSTALL_FAILED_ALREADY_EXISTS":
|
||||
logging.warn("%s is already installed on %s." % (apk, dev))
|
||||
else:
|
||||
raise Exception("Failed to install %s on %s: %s" % (
|
||||
raise FDroidException("Failed to install %s on %s: %s" % (
|
||||
apk, dev, fail))
|
||||
|
||||
logging.info("\nFinished")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue