forked from ChipaDevTeam/PocketOptionAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexceptions.py
More file actions
50 lines (28 loc) · 971 Bytes
/
exceptions.py
File metadata and controls
50 lines (28 loc) · 971 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
39
40
41
42
43
44
45
46
47
48
49
50
"""
Custom exceptions for the PocketOption API
"""
class PocketOptionError(Exception):
"""Base exception for all PocketOption API errors"""
from typing import Optional
def __init__(self, message: str, error_code: Optional[str] = None):
super().__init__(message)
self.message = message
self.error_code = error_code
class ConnectionError(PocketOptionError):
"""Raised when connection to PocketOption fails"""
pass
class AuthenticationError(PocketOptionError):
"""Raised when authentication fails"""
pass
class OrderError(PocketOptionError):
"""Raised when an order operation fails"""
pass
class TimeoutError(PocketOptionError):
"""Raised when an operation times out"""
pass
class InvalidParameterError(PocketOptionError):
"""Raised when invalid parameters are provided"""
pass
class WebSocketError(PocketOptionError):
"""Raised when WebSocket operations fail"""
pass