-
Notifications
You must be signed in to change notification settings - Fork 4
/
flow_exceptions.py
62 lines (38 loc) · 1.84 KB
/
flow_exceptions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# Copyright (c) 2019 Lars Hupfeldt Nielsen, Hupfeldt IT
# All rights reserved. This work is under a BSD license, see LICENSE.TXT.
import abc
from .propagation_types import Propagation
class JobControlException(Exception):
def __init__(self, message, propagation=Propagation.NORMAL):
super().__init__(message)
self.propagation = propagation
class FlowTimeoutException(JobControlException):
pass
class FlowScopeException(JobControlException):
pass
class JobNotIdleException(JobControlException):
pass
class MessageRedefinedException(JobControlException):
pass
class JobControlFailException(JobControlException, metaclass=abc.ABCMeta):
pass
class FailedSingleJobException(JobControlFailException):
def __init__(self, job, propagation):
msg = "Failed job: " + repr(job) + ", propagation:" + str(propagation)
super().__init__(msg, propagation)
class MissingJobsException(JobControlFailException):
def __init__(self, ex):
super().__init__(str(ex), propagation=Propagation.NORMAL)
class FailedChildJobException(JobControlFailException):
def __init__(self, flow_job, failed_child_job, propagation):
msg = "Failed child job in: " + repr(flow_job) + ", child job:" + repr(failed_child_job) + ", propagation:" + str(propagation)
super().__init__(msg, propagation)
class FailedChildJobsException(JobControlFailException):
def __init__(self, flow_job, failed_child_jobs, propagation):
msg = "Failed child jobs in: " + repr(flow_job) + ", child jobs:" + repr(failed_child_jobs) + ", propagation:" + str(propagation)
super().__init__(msg, propagation)
class FinalResultException(JobControlFailException):
def __init__(self, build_result):
msg = "Flow Unsuccessful: {}".format(build_result)
super().__init__(msg)
self.result = build_result