*Add error to RPCResponse, dont put inside data
This commit is contained in:
parent
b37b3052ec
commit
1a9f08cbba
15
src/rpc.ts
15
src/rpc.ts
|
@ -49,11 +49,8 @@ interface RPCRequest {
|
||||||
|
|
||||||
interface RPCResponse {
|
interface RPCResponse {
|
||||||
updated: number;
|
updated: number;
|
||||||
data:
|
data: any;
|
||||||
| any
|
error?: string;
|
||||||
| {
|
|
||||||
error: string | boolean;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function hash(data: string): string {
|
function hash(data: string): string {
|
||||||
|
@ -137,9 +134,11 @@ async function processRequest(request: RPCRequest): Promise<RPCResponse> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dbData.data = error
|
if (error) {
|
||||||
? { error }
|
dbData.error = error as string;
|
||||||
: (rpcResp as unknown as JSONRPCResponseWithResult).result;
|
} else {
|
||||||
|
dbData.data = (rpcResp as unknown as JSONRPCResponseWithResult).result;
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
(!processedRequests.get(reqId) || request.bypassCache) &&
|
(!processedRequests.get(reqId) || request.bypassCache) &&
|
||||||
|
|
Loading…
Reference in New Issue