1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-09-20 01:06:17 +02:00

- babysitter: catch ServiceRuntimeError

Note: it is probably better to raise a ServiceRuntimeError in
Serviceinfo.execute instead of Package.commit because "execute"
has all the information about the failing service...
This commit is contained in:
Marcus Huewe 2013-08-29 15:22:25 +02:00
parent 1176983a9a
commit 1614123f82
2 changed files with 5 additions and 1 deletions

View File

@ -165,6 +165,8 @@ def run(prg, argv=None):
except oscerr.ExtRuntimeError as e:
print(e.file + ':', e.msg, file=sys.stderr)
return 1
except oscerr.ServiceRuntimeError as e:
print(e.msg, file=sys.stderr)
except oscerr.WorkingCopyOutdated as e:
print(e, file=sys.stderr)
return 1

View File

@ -1305,7 +1305,9 @@ class Package:
if not skip_local_service_run:
r = self.run_source_services(mode="trylocal", verbose=verbose)
if r is not 0:
raise oscerr.ServiceRuntimeError(r)
# FIXME: it is better to raise this in Serviceinfo.execute with more
# information (like which service/command failed)
raise oscerr.ServiceRuntimeError('A service failed with error: %d' % r)
if not self.todo:
self.todo = [i for i in self.to_be_added if not i in self.filenamelist] + self.filenamelist