66class CycodeError (Exception ):
77 """Base class for all custom exceptions"""
88
9+ def __str__ (self ) -> str :
10+ class_name = self .__class__ .__name__
11+ return f'{ class_name } error occurred.'
12+
913
1014class RequestError (CycodeError ): ...
1115
@@ -27,10 +31,7 @@ def __init__(self, status_code: int, error_message: str, response: Response) ->
2731 super ().__init__ (self .error_message )
2832
2933 def __str__ (self ) -> str :
30- return (
31- f'error occurred during the request. status code: { self .status_code } , error message: '
32- f'{ self .error_message } '
33- )
34+ return f'HTTP error occurred during the request (code { self .status_code } ). Message: { self .error_message } '
3435
3536
3637class ScanAsyncError (CycodeError ):
@@ -39,7 +40,7 @@ def __init__(self, error_message: str) -> None:
3940 super ().__init__ (self .error_message )
4041
4142 def __str__ (self ) -> str :
42- return f'error occurred during the scan. error message : { self .error_message } '
43+ return f'Async scan error occurred during the scan. Message : { self .error_message } '
4344
4445
4546class ReportAsyncError (CycodeError ):
@@ -54,7 +55,7 @@ def __init__(self, error_message: str, response: Response) -> None:
5455 super ().__init__ (self .error_message )
5556
5657 def __str__ (self ) -> str :
57- return 'Http Unauthorized Error '
58+ return f'HTTP unauthorized error occurred during the request. Message: { self . error_message } '
5859
5960
6061class ZipTooLargeError (CycodeError ):
@@ -72,7 +73,7 @@ def __init__(self, error_message: str) -> None:
7273 super ().__init__ ()
7374
7475 def __str__ (self ) -> str :
75- return f'Something went wrong during the authentication process, error message : { self .error_message } '
76+ return f'Something went wrong during the authentication process. Message : { self .error_message } '
7677
7778
7879class TfplanKeyError (CycodeError ):
@@ -106,6 +107,6 @@ def __str__(self) -> str:
106107 code = 'ssl_error' ,
107108 message = 'An SSL error occurred when trying to connect to the Cycode API. '
108109 'If you use an on-premises installation or a proxy that intercepts SSL traffic '
109- 'you should use the CURL_CA_BUNDLE environment variable to specify path to a valid .pem or similar. ' ,
110+ 'you should use the CURL_CA_BUNDLE environment variable to specify path to a valid .pem or similar' ,
110111 ),
111112}
0 commit comments