-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from yeger00/pydantic-4
Change the rest to pydantic
- Loading branch information
Showing
10 changed files
with
144 additions
and
460 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from typing import Any | ||
from enum import IntEnum | ||
|
||
|
||
class ErrorCodes(IntEnum): | ||
# Defined by JSON RPC | ||
ParseError = -32700 | ||
InvalidRequest = -32600 | ||
MethodNotFound = -32601 | ||
InvalidParams = -32602 | ||
InternalError = -32603 | ||
serverErrorStart = -32099 | ||
serverErrorEnd = -32000 | ||
ServerNotInitialized = -32002 | ||
UnknownErrorCode = -32001 | ||
|
||
# Defined by the protocol. | ||
RequestCancelled = -32800 | ||
ContentModified = -32801 | ||
|
||
|
||
class ResponseError(Exception): | ||
def __init__(self, code: ErrorCodes, message: str, data: Any = None): | ||
self.code = code | ||
self.message = message | ||
if data: | ||
self.data = data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.