Skip to content

Commit 3f58c04

Browse files
kcatrofilipowm
authored andcommitted
Exit with 1 on GitLab or GCasC exceptions
1 parent 02061b0 commit 3f58c04

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.6.1
1+
0.6.2

gcasc/exceptions.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import sys
2+
13
from gitlab import (
24
GitlabAuthenticationError,
35
GitlabCreateError,
@@ -51,7 +53,7 @@ def handle_gcasc_exception(exc, logger): # type: (GcascException, Logger) -> ()
5153
switch = {ValidationException: _handle_validation_exception}
5254
exc_type = type(exc)
5355
switch.get(exc_type, _log_exception)(exc, logger)
54-
56+
sys.exit(1)
5557

5658
def handle_gitlab_exception(exc, logger): # type: (GitlabError, Logger) -> ()
5759
switch = {
@@ -67,3 +69,4 @@ def handle_gitlab_exception(exc, logger): # type: (GitlabError, Logger) -> ()
6769
exc_type = type(exc)
6870
message = switch.get(exc_type, "Error occurred while communicating with GitLab")
6971
logger.error(f"{message}\nHTTP {exc.response_code}, {exc.error_message}")
72+
sys.exit(1)

0 commit comments

Comments
 (0)