mirror of
https://github.com/fauxpilot/fauxpilot.git
synced 2025-08-14 02:28:06 -07:00
Reformat the error to match OpenAI's
This commit is contained in:
parent
e2486698e0
commit
b7b85461af
2 changed files with 33 additions and 4 deletions
19
copilot_proxy/utils/errors.py
Normal file
19
copilot_proxy/utils/errors.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
from typing import *
|
||||
|
||||
class FauxPilotException(Exception):
|
||||
def __init__(self, message: str, type: Optional[str] = None, param: Optional[str] = None, code: Optional[int] = None):
|
||||
super().__init__(message)
|
||||
self.message = message
|
||||
self.type = type
|
||||
self.param = param
|
||||
self.code = code
|
||||
|
||||
def json(self):
|
||||
return {
|
||||
'error': {
|
||||
'message': self.message,
|
||||
'type': self.type,
|
||||
'param': self.param,
|
||||
'code': self.code
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue