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