Skip to content

Commit

Permalink
feat: 🔖 release changes for version 0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
DeXtroTip committed Oct 29, 2024
1 parent 7ae6810 commit 2fb3ec0
Show file tree
Hide file tree
Showing 32 changed files with 3,335 additions and 2,200 deletions.
6 changes: 5 additions & 1 deletion galaxy/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,11 @@ def job_listener(event):

async def _run_integration():
async with Magneto(instance.config.rely.url, instance.config.rely.token, logger=logger) as magneto_client:
await run_integration(instance, magneto_client=magneto_client, logger=app.state.logger)
success = await run_integration(instance, magneto_client=magneto_client, logger=app.state.logger)
if success:
logger.info("Integration %r run completed successfully: %r", instance.type_, instance.id_)
else:
logger.error("Integration %r run failed: %r", instance.type_, instance.id_)

@app.on_event("startup")
async def startup_event():
Expand Down
57 changes: 57 additions & 0 deletions galaxy/core/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
from dataclasses import dataclass

__all__ = ["GalaxyError", "IntegrationRunError", "IntegrationRunMethodError", "EntityPushTaskError"]


class GalaxyError(Exception):
"""Base class for all Galaxy errors."""


class CronjobRunError(GalaxyError):
"""Exception raised when Galaxy cronjob run fails."""


@dataclass(kw_only=True)
class IntegrationRunError(GalaxyError):
"""Exception raised when an integration run fails."""

integration_id: str
integration_type: str
errors: list[Exception]

def __str__(self):
return f"Error running integration: {self.integration_id} ({self.integration_type}): {self.errors}"


@dataclass(kw_only=True)
class IntegrationRunMethodError(Exception):
"""Exception raised when an integration run method fails."""

integration_id: str
integration_type: str
method: str
error: Exception

def __str__(self):
return (
f"Error running in method {self.method!r} for integration {self.integration_id}"
f" ({self.integration_type}): {self.error}"
)


@dataclass(kw_only=True)
class EntityPushTaskError(Exception):
"""Exception raised when an entity push task fails."""

integration_id: str
integration_type: str
error: Exception
entity_ids: list[str]

def __str__(self):
if len(self.entity_ids) == 1:
return f"Entity ({self.entity_ids[0]!r}) push task error: {self.integration_id} ({self.integration_type}): {self.error} "
return (
f"Entity push task error: {self.integration_id} ({self.integration_type}): {self.error} "
f"(entity_ids: {', '.join(self.entity_ids)})"
)
Loading

0 comments on commit 2fb3ec0

Please sign in to comment.