eth-json-rpc-errors
Advanced tools
Comparing version 1.0.1 to 1.1.0
{ | ||
"name": "eth-json-rpc-errors", | ||
"version": "1.0.1", | ||
"version": "1.1.0", | ||
"description": "Ethereum JSON RPC errors and standard JSON RPC 2.0 errors.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -104,3 +104,7 @@ | ||
serialized.code = fallbackError.code | ||
serialized.message = fallbackError.message | ||
serialized.message = ( | ||
error && error.message | ||
? error.message | ||
: fallbackError.message | ||
) | ||
serialized.data = { originalError: assignOriginalError(error) } | ||
@@ -107,0 +111,0 @@ } |
@@ -20,2 +20,3 @@ | ||
const invalidError6 = undefined | ||
const invalidError7 = { code: 34, message: dummyMessage , data: { ...dummyData } } | ||
@@ -139,2 +140,18 @@ const validError0 = { code: 4001, message: dummyMessage } | ||
test('invalid error: invalid code with string message', t => { | ||
const result = serializeError(invalidError7) | ||
t.ok( | ||
dequal( | ||
result, | ||
{ | ||
code: jsonRpcCodes.internal, | ||
message: dummyMessage, | ||
data: { originalError: { ...invalidError7 } } | ||
} | ||
), | ||
'serialized error matches expected result' | ||
) | ||
t.end() | ||
}) | ||
test('valid error: code and message only', t => { | ||
@@ -141,0 +158,0 @@ const result = serializeError(validError0) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31962
868