File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 1616class Error (Exception ):
1717 """docstring for Error"""
1818 def __init__ (self , msg ):
19- self .args = (f"{ type (self ).__name__ } : { msg } " ,)
19+ if isinstance (msg , list ):
20+ self .args = (f"{ type (self ).__name__ } : \n { chr (10 ).join (msg )} " ,)
21+ else :
22+ self .args = (f"{ type (self ).__name__ } : { msg } " ,)
2023 sys .exit (self )
2124
2225class BadRequestError (Error ):
2326 """docstring for BadRequestError"""
2427
28+ class BadRequestWarning (Error ):
29+ """docstring for BadRequestError"""
30+
2531class OAuthNego ():
2632 """
2733 The base class to create python client that is able to
@@ -87,9 +93,11 @@ def connect(self, r_get):
8793 def maybe_json (self , data ):
8894 try :
8995 loads = json .loads (data )
90- # logger.info(f"\n\n{type(data)}\n{type( loads) }\n\n")
96+ # logger.info(f"\n\n{loads}\n\n")
9197 if isinstance (loads , dict ) and loads .get ("DB_ACTION_ERROR" ):
9298 raise BadRequestError (loads .get ("DB_ACTION_ERROR" ))
99+ if isinstance (loads , dict ) and loads .get ("DB_ACTION_WARNING" ):
100+ raise BadRequestWarning (loads .get ("DB_ACTION_WARNING" ))
93101 self .data_type = 'json'
94102 return loads
95103 except json .decoder .JSONDecodeError :
You can’t perform that action at this time.
0 commit comments