Skip to content

Commit 5739b53

Browse files
chore(sentry apps): Introduce new error types for sentry apps (#82507)
1 parent 3237181 commit 5739b53

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
from enum import Enum
2+
3+
4+
class SentryAppErrorType(Enum):
5+
CLIENT = "client"
6+
INTEGRATOR = "integrator"
7+
SENTRY = "sentry"
8+
9+
10+
# Represents a user/client error that occured during a Sentry App process
11+
class SentryAppError(Exception):
12+
error_type = SentryAppErrorType.CLIENT
13+
status_code = 400
14+
15+
def __init__(
16+
self,
17+
error: Exception | None = None,
18+
status_code: int | None = None,
19+
) -> None:
20+
if status_code:
21+
self.status_code = status_code
22+
23+
24+
# Represents an error caused by a 3p integrator during a Sentry App process
25+
class SentryAppIntegratorError(Exception):
26+
error_type = SentryAppErrorType.INTEGRATOR
27+
status_code = 400
28+
29+
def __init__(
30+
self,
31+
error: Exception | None = None,
32+
status_code: int | None = None,
33+
) -> None:
34+
if status_code:
35+
self.status_code = status_code

0 commit comments

Comments
 (0)