Skip to content

Commit

Permalink
chore(sentry apps): Introduce new error types for sentry apps (#82507)
Browse files Browse the repository at this point in the history
  • Loading branch information
Christinarlong authored Dec 20, 2024
1 parent 3237181 commit 5739b53
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/sentry/sentry_apps/utils/errors.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from enum import Enum


class SentryAppErrorType(Enum):
CLIENT = "client"
INTEGRATOR = "integrator"
SENTRY = "sentry"


# Represents a user/client error that occured during a Sentry App process
class SentryAppError(Exception):
error_type = SentryAppErrorType.CLIENT
status_code = 400

def __init__(
self,
error: Exception | None = None,
status_code: int | None = None,
) -> None:
if status_code:
self.status_code = status_code


# Represents an error caused by a 3p integrator during a Sentry App process
class SentryAppIntegratorError(Exception):
error_type = SentryAppErrorType.INTEGRATOR
status_code = 400

def __init__(
self,
error: Exception | None = None,
status_code: int | None = None,
) -> None:
if status_code:
self.status_code = status_code

0 comments on commit 5739b53

Please sign in to comment.