Better error handling.
This commit is contained in:
parent
d1539a3341
commit
9197eee3a9
|
@ -8,12 +8,10 @@ import osdk.utils as utils
|
|||
import osdk.targets as targets
|
||||
import osdk.manifests as manifests
|
||||
|
||||
|
||||
__version__="0.2.1"
|
||||
|
||||
CMDS = {}
|
||||
|
||||
|
||||
def parseOptions(args: list[str]) -> dict:
|
||||
result = {
|
||||
'opts': {},
|
||||
|
|
|
@ -126,9 +126,9 @@ def buildAll(targetId: str, props: dict = {}) -> None:
|
|||
|
||||
try:
|
||||
utils.runCmd("ninja", "-v", "-f", target["ninjafile"])
|
||||
except:
|
||||
except Exception as e:
|
||||
raise utils.CliException(
|
||||
"Failed to build all for " + target["key"])
|
||||
"Failed to build all for " + target["key"] + ": " + e)
|
||||
|
||||
|
||||
def buildOne(targetId: str, componentId: str, props: dict = {}) -> str:
|
||||
|
@ -146,8 +146,7 @@ def buildOne(targetId: str, componentId: str, props: dict = {}) -> str:
|
|||
try:
|
||||
utils.runCmd("ninja", "-v", "-f",
|
||||
target["ninjafile"], manifests[componentId]["out"])
|
||||
except:
|
||||
except Exception as e:
|
||||
raise utils.CliException(
|
||||
f"Failed to build {componentId} for target '{target['key']}'")
|
||||
|
||||
f"Failed to build {componentId} for target '{target['key']}': {e}")
|
||||
return manifests[componentId]["out"]
|
||||
|
|
|
@ -144,8 +144,8 @@ def downloadFile(url: str) -> str:
|
|||
|
||||
os.rename(tmp, dest)
|
||||
return dest
|
||||
except:
|
||||
raise CliException(f"Failed to download {url}")
|
||||
except requests.exceptions.RequestException as e:
|
||||
raise CliException(f"Failed to download {url}: {e}")
|
||||
|
||||
|
||||
def runCmd(*args: str) -> bool:
|
||||
|
|
Loading…
Reference in a new issue