Skip to content

Commit

Permalink
chore: raise HarveyError for failed deploys, no redundant exit on suc…
Browse files Browse the repository at this point in the history
…cess
  • Loading branch information
Justintime50 committed Apr 10, 2024
1 parent 9ed79d8 commit ff4f731
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- Adds support for Python 3.12
- Prints deployment log to the error logger if `log_level` is set to `DEBUG`
- Raises a `HarveyError` on deployment fail instead of `sys.exit(1)`, removes redundant `sys.exit(0)` on success

## v1.0.3 (2023-10-25)

Expand Down
6 changes: 2 additions & 4 deletions harvey/utils/deployments.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import sys
from typing import (
Any,
Dict,
Expand All @@ -7,6 +6,7 @@
import woodchips

from harvey.config import Config
from harvey.errors import HarveyError
from harvey.messages import Message
from harvey.repos.deployments import store_deployment_details
from harvey.repos.locks import (
Expand Down Expand Up @@ -37,7 +37,7 @@ def kill_deployment(message: str, webhook: Dict[str, Any]):
if Config.use_slack:
Message.send_slack_message(error_message)

sys.exit(1)
HarveyError(error_message)


def succeed_deployment(message: str, webhook: Dict[str, Any]):
Expand All @@ -55,8 +55,6 @@ def succeed_deployment(message: str, webhook: Dict[str, Any]):
if Config.use_slack:
Message.send_slack_message(success_message)

sys.exit(0)


def _strip_emojis_from_logs(output: str) -> str:
"""Replace the emojis for logs since they won't render properly there."""
Expand Down

0 comments on commit ff4f731

Please sign in to comment.