Skip to content

Commit

Permalink
Fix inverse condition
Browse files Browse the repository at this point in the history
  • Loading branch information
syyyr committed Sep 10, 2024
1 parent 1039734 commit 99cceef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "libshv-js",
"version": "3.3.0",
"version": "3.3.1",
"description": "Typescript implementation of libshv",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
Expand Down
6 changes: 3 additions & 3 deletions src/rpcmessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,14 @@ class RpcMessage {
}

const error_map = this.value[KeyError];
if (!(typeof error_map[ERROR_CODE] !== 'number')) {
if (typeof error_map[ERROR_CODE] !== 'number') {
return new ProtocolError('Response had an error, but this error did not contain at least an error code');
}

const code = error_map[ERROR_CODE];
const code = error_map[ERROR_CODE] as unknown;

const ErrorType = (() => {
switch (code.value) {
switch (code) {
case ErrorCode.InvalidRequest: return InvalidRequest;
case ErrorCode.MethodNotFound: return MethodNotFound;
case ErrorCode.InvalidParams: return InvalidParams;
Expand Down

0 comments on commit 99cceef

Please sign in to comment.