forked from runpod/runpod-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.py
More file actions
38 lines (27 loc) · 764 Bytes
/
error.py
File metadata and controls
38 lines (27 loc) · 764 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""
runpd | error.py
This file contains the error classes for the runpod package.
"""
from typing import Optional
class RunPodError(Exception):
"""
Base class for all runpod errors
"""
def __init__(self, message: Optional[str] = None):
super().__init__(message)
self.message = message
def __str__(self):
if self.message:
return self.message
return super().__str__()
class AuthenticationError(RunPodError):
"""
Raised when authentication fails
"""
class QueryError(RunPodError):
"""
Raised when a GraphQL query fails
"""
def __init__(self, message: Optional[str] = None, query: Optional[str] = None):
super().__init__(message)
self.query = query