-
Notifications
You must be signed in to change notification settings - Fork 1
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 #14 from lightclients/validation
Validate input of RPC requests
- Loading branch information
Showing
12 changed files
with
474 additions
and
129 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,6 59,6 @@ | |
"rpc" | ||
], | ||
"lint-staged": { | ||
"*.{js,css,md}": "prettier --write" | ||
"*.{ts,js,md}": "prettier --write" | ||
} | ||
} |
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 |
---|---|---|
@@ -1,20 1,13 @@ | ||
const INVALID_PARAMS = -32602; | ||
const INTERNAL_ERROR = -32603; | ||
import { JSONRPCErrorCode, JSONRPCErrorException } from 'json-rpc-2.0'; | ||
|
||
export const PARSE_ERROR = -32700; | ||
export const METHOD_NOT_FOUND = -32601; | ||
export const INVALID_REQUEST = -32600; | ||
|
||
export class InternalError extends Error { | ||
public code = INTERNAL_ERROR | ||
constructor(message: string) { | ||
super(message); | ||
} | ||
export class InternalError extends JSONRPCErrorException { | ||
constructor(message: string) { | ||
super(message, JSONRPCErrorCode.InternalError); | ||
} | ||
} | ||
|
||
export class InvalidParamsError extends Error { | ||
public code = INVALID_PARAMS | ||
constructor(message: string) { | ||
super(message); | ||
} | ||
} | ||
export class InvalidParamsError extends JSONRPCErrorException { | ||
constructor(message: string) { | ||
super(message, JSONRPCErrorCode.InvalidParams); | ||
} | ||
} |
Oops, something went wrong.