Slightly improve error handling
* Fix: Do not swallow traces when crashing before log init (e.g. during argument parsing) * Show a link to the troubleshooting page, when an error happens * (Formatting done by autopep8 in pmb/config/init.py)
This commit is contained in:
parent
060e5a5876
commit
fcc5501a44
|
@ -39,7 +39,7 @@ def init(args):
|
||||||
logging.info("Location of the 'work' path. Multiple chroots (native,"
|
logging.info("Location of the 'work' path. Multiple chroots (native,"
|
||||||
" device arch, device rootfs) will be created in there.")
|
" device arch, device rootfs) will be created in there.")
|
||||||
cfg["pmbootstrap"]["work"] = os.path.expanduser(pmb.helpers.cli.ask(args, "Work path",
|
cfg["pmbootstrap"]["work"] = os.path.expanduser(pmb.helpers.cli.ask(args, "Work path",
|
||||||
None, args.work, False))
|
None, args.work, False))
|
||||||
os.makedirs(cfg["pmbootstrap"]["work"], 0o700, True)
|
os.makedirs(cfg["pmbootstrap"]["work"], 0o700, True)
|
||||||
|
|
||||||
# Parallel job count
|
# Parallel job count
|
||||||
|
|
|
@ -40,11 +40,12 @@ import pmb.install
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
try:
|
# Parse arguments, set up logging
|
||||||
# Parse arguments
|
args = pmb.parse.arguments()
|
||||||
args = pmb.parse.arguments()
|
pmb.helpers.logging.init(args)
|
||||||
pmb.helpers.logging.init(args)
|
|
||||||
|
|
||||||
|
# Wrap everything to display nice error messages
|
||||||
|
try:
|
||||||
# Initialize or require config
|
# Initialize or require config
|
||||||
if args.action == "init":
|
if args.action == "init":
|
||||||
return pmb.config.init(args)
|
return pmb.config.init(args)
|
||||||
|
@ -102,6 +103,8 @@ def main():
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.info("ERROR: " + str(e))
|
logging.info("ERROR: " + str(e))
|
||||||
logging.info("Run 'pmbootstrap log' for details.")
|
logging.info("Run 'pmbootstrap log' for details.")
|
||||||
|
logging.info(
|
||||||
|
"See also: https://github.com/postmarketOS/pmbootstrap/wiki/Troubleshooting")
|
||||||
logging.debug(traceback.format_exc())
|
logging.debug(traceback.format_exc())
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue