mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
[fix] Properly catch Invalid manifest json with ValueError. (#324)
* [fix] Properly catch Invalid manifest json with ValueError. * [fix] display detailed error in every case for invalid manifest
This commit is contained in:
parent
3235f5f3fe
commit
535f36b1c1
2 changed files with 8 additions and 5 deletions
|
@ -20,7 +20,7 @@
|
||||||
"app_location_already_used": "An app is already installed in this location",
|
"app_location_already_used": "An app is already installed in this location",
|
||||||
"app_location_install_failed": "Unable to install the app in this location",
|
"app_location_install_failed": "Unable to install the app in this location",
|
||||||
"app_location_unavailable": "This url is not available or conflicts with an already installed app",
|
"app_location_unavailable": "This url is not available or conflicts with an already installed app",
|
||||||
"app_manifest_invalid": "Invalid app manifest",
|
"app_manifest_invalid": "Invalid app manifest: {error}",
|
||||||
"app_no_upgrade": "No app to upgrade",
|
"app_no_upgrade": "No app to upgrade",
|
||||||
"app_not_correctly_installed": "{app:s} seems to be incorrectly installed",
|
"app_not_correctly_installed": "{app:s} seems to be incorrectly installed",
|
||||||
"app_not_installed": "{app:s} is not installed",
|
"app_not_installed": "{app:s} is not installed",
|
||||||
|
|
|
@ -1424,6 +1424,9 @@ def _extract_app_from_file(path, remove=False):
|
||||||
manifest['lastUpdate'] = int(time.time())
|
manifest['lastUpdate'] = int(time.time())
|
||||||
except IOError:
|
except IOError:
|
||||||
raise MoulinetteError(errno.EIO, m18n.n('app_install_files_invalid'))
|
raise MoulinetteError(errno.EIO, m18n.n('app_install_files_invalid'))
|
||||||
|
except ValueError as e:
|
||||||
|
raise MoulinetteError(errno.EINVAL,
|
||||||
|
m18n.n('app_manifest_invalid', error=e.strerror))
|
||||||
|
|
||||||
logger.info(m18n.n('done'))
|
logger.info(m18n.n('done'))
|
||||||
|
|
||||||
|
@ -1517,9 +1520,9 @@ def _fetch_app_from_git(app):
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
raise MoulinetteError(errno.EIO,
|
raise MoulinetteError(errno.EIO,
|
||||||
m18n.n('app_sources_fetch_failed'))
|
m18n.n('app_sources_fetch_failed'))
|
||||||
except IOError:
|
except ValueError as e:
|
||||||
raise MoulinetteError(errno.EIO,
|
raise MoulinetteError(errno.EIO,
|
||||||
m18n.n('app_manifest_invalid'))
|
m18n.n('app_manifest_invalid', error=e.strerror))
|
||||||
else:
|
else:
|
||||||
logger.info(m18n.n('done'))
|
logger.info(m18n.n('done'))
|
||||||
|
|
||||||
|
@ -1574,9 +1577,9 @@ def _fetch_app_from_git(app):
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
raise MoulinetteError(errno.EIO,
|
raise MoulinetteError(errno.EIO,
|
||||||
m18n.n('app_sources_fetch_failed'))
|
m18n.n('app_sources_fetch_failed'))
|
||||||
except IOError:
|
except ValueError as e:
|
||||||
raise MoulinetteError(errno.EIO,
|
raise MoulinetteError(errno.EIO,
|
||||||
m18n.n('app_manifest_invalid'))
|
m18n.n('app_manifest_invalid', error=e.strerror))
|
||||||
else:
|
else:
|
||||||
logger.info(m18n.n('done'))
|
logger.info(m18n.n('done'))
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue