@vechain/sdk-errors
Advanced tools
Comparing version 1.0.0-rc.1 to 1.0.0-rc.2
/** | ||
* Function to stringify data correctly. | ||
* Some data types like Error, Map, Set, etc. are not stringified correctly by JSON.stringify. | ||
* This function handles those cases and avoid circular references. | ||
* This function handles those cases and avoids circular references. | ||
* | ||
@@ -6,0 +6,0 @@ * @param data - The data to be stringified. |
'use strict'; | ||
var C=Object.defineProperty;var P=(t,a)=>{for(var e in a)C(t,e,{get:a[e],enumerable:!0});};var R={};P(R,{CannotFindTransaction:()=>J,CertificateSignatureMismatch:()=>u,ContractCallError:()=>l,ContractDeploymentFailed:()=>y,InvalidAbiDataToEncodeOrDecode:()=>f,InvalidAbiItem:()=>i,InvalidAbiSignatureFormat:()=>E,InvalidAddress:()=>d,InvalidBloom:()=>D,InvalidBloomParams:()=>g,InvalidCommandLineArguments:()=>X,InvalidConfigurationFile:()=>Z,InvalidConfigurationFilePath:()=>Y,InvalidDataType:()=>j,InvalidHDKey:()=>h,InvalidHDKeyMnemonic:()=>O,InvalidHTTPRequest:()=>w,InvalidKeystore:()=>V,InvalidKeystoreParams:()=>k,InvalidOperation:()=>M,InvalidRLP:()=>T,InvalidSecp256k1MessageHash:()=>A,InvalidSecp256k1PrivateKey:()=>_,InvalidSecp256k1Signature:()=>q,InvalidTransactionField:()=>L,JSONRPCInternalError:()=>G,JSONRPCInvalidParams:()=>W,JSONRPCInvalidRequest:()=>U,JSONRPCMethodNotFound:()=>z,JSONRPCParseError:()=>$,JSONRPCProviderError:()=>p,JSONRPCServerError:()=>Q,NotDelegatedTransaction:()=>N,PollExecution:()=>K,ProviderMethodError:()=>S,SignerMethodError:()=>B,UnavailableTransactionField:()=>H,UnsupportedOperation:()=>b,VechainSDKError:()=>r,assertInnerError:()=>m,createErrorMessage:()=>x,stringifyData:()=>c});var c=t=>JSON.stringify(t,(()=>{let e=new WeakSet;return (s,o)=>{if(typeof o=="object"&&o!==null&&s!==""){if(e.has(o))return;e.add(o);}return o}})(),2);function m(t){return t instanceof Error?t:new Error(`Inner error is not an instance of Error. Object: | ||
${c(t)}`)}function x(t,a,e,s){return `Method '${t}' failed. | ||
var C=Object.defineProperty;var P=(t,a)=>{for(var o in a)C(t,o,{get:a[o],enumerable:!0});};var R={};P(R,{CannotFindTransaction:()=>N,CertificateSignatureMismatch:()=>u,ContractCallError:()=>l,ContractDeploymentFailed:()=>y,InvalidAbiDataToEncodeOrDecode:()=>f,InvalidAbiItem:()=>i,InvalidAbiSignatureFormat:()=>E,InvalidAddress:()=>d,InvalidBloom:()=>g,InvalidBloomParams:()=>D,InvalidCommandLineArguments:()=>X,InvalidConfigurationFile:()=>Z,InvalidConfigurationFilePath:()=>Y,InvalidDataType:()=>j,InvalidHDKey:()=>h,InvalidHDKeyMnemonic:()=>O,InvalidHTTPRequest:()=>w,InvalidKeystore:()=>V,InvalidKeystoreParams:()=>k,InvalidOperation:()=>J,InvalidRLP:()=>T,InvalidSecp256k1MessageHash:()=>A,InvalidSecp256k1PrivateKey:()=>_,InvalidSecp256k1Signature:()=>q,InvalidTransactionField:()=>L,JSONRPCInternalError:()=>G,JSONRPCInvalidParams:()=>W,JSONRPCInvalidRequest:()=>U,JSONRPCMethodNotFound:()=>z,JSONRPCParseError:()=>$,JSONRPCProviderError:()=>c,JSONRPCServerError:()=>Q,NotDelegatedTransaction:()=>M,PollExecution:()=>K,ProviderMethodError:()=>S,SignerMethodError:()=>B,UnavailableTransactionField:()=>H,UnsupportedOperation:()=>b,VechainSDKError:()=>r,assertInnerError:()=>m,createErrorMessage:()=>x,stringifyData:()=>p});var p=t=>JSON.stringify(t,(()=>{let o=new WeakSet;return (s,e)=>{if(typeof e=="object"&&e!==null&&s!==""){if(o.has(e))return;o.add(e);}return e}})(),2);function m(t){return t instanceof Error?t:new Error(`Inner error is not an instance of Error. Object: | ||
${p(t)}`)}function x(t,a,o,s){let e=s?.message!==void 0?` | ||
-Internal error: | ||
${s.message}`:"";return `Method '${t}' failed. | ||
-Reason: '${a}' | ||
-Parameters: | ||
${c(e)}${s?.message!==void 0?` | ||
-Internal error: | ||
${s.message}`:""}`}var r=class extends Error{constructor(e,s,o,n){super(x(e,s,o,n===void 0?void 0:m(n)));this.methodName=e;this.errorMessage=s;this.data=o;this.innerError=n;}};var f=class extends r{},i=class extends r{},E=class extends r{};var d=class extends r{};var D=class extends r{},g=class extends r{};var u=class extends r{};var y=class extends r{},l=class extends r{};var j=class extends r{},b=class extends r{};var O=class extends r{},h=class extends r{};var w=class extends r{};var V=class extends r{},k=class extends r{};var K=class extends r{};var S=class extends r{},p=class extends r{constructor(e,s,o,n,F){super(e,o,{code:s,message:o,data:n},F);this.methodName=e;this.innerError=F;}},$=class extends p{constructor(e,s,o,n){super(e,-32700,s,o,n);this.methodName=e;this.innerError=n;}},U=class extends p{constructor(e,s,o,n){super(e,-32600,s,o,n);this.methodName=e;this.innerError=n;}},z=class extends p{constructor(e,s,o,n){super(e,-32601,s,o,n);this.methodName=e;this.innerError=n;}},W=class extends p{constructor(e,s,o,n){super(e,-32602,s,o,n);this.methodName=e;this.innerError=n;}},G=class extends p{constructor(e,s,o,n){super(e,-32603,s,o,n);this.methodName=e;this.innerError=n;}},Q=class extends p{constructor(e,s,o,n){super(e,-32e3,s,o,n);this.methodName=e;this.innerError=n;}};var T=class extends r{};var X=class extends r{},Y=class extends r{},Z=class extends r{};var _=class extends r{},A=class extends r{},q=class extends r{};var B=class extends r{};var H=class extends r{},L=class extends r{},N=class extends r{},J=class extends r{};var M=class extends r{}; | ||
${p(o)}`+e}var r=class extends Error{constructor(o,s,e,n){super(x(o,s,e,n===void 0?void 0:m(n)));this.methodName=o;this.errorMessage=s;this.data=e;this.innerError=n;}};var f=class extends r{},i=class extends r{},E=class extends r{};var d=class extends r{};var g=class extends r{},D=class extends r{};var u=class extends r{};var y=class extends r{},l=class extends r{};var j=class extends r{},b=class extends r{};var O=class extends r{},h=class extends r{};var w=class extends r{};var V=class extends r{},k=class extends r{};var K=class extends r{};var S=class extends r{},c=class extends r{constructor(o,s,e,n,F){super(o,e,{code:s,message:e,data:n},F);this.methodName=o;this.innerError=F;}},$=class extends c{constructor(o,s,e,n){super(o,-32700,s,e,n);this.methodName=o;this.innerError=n;}},U=class extends c{constructor(o,s,e,n){super(o,-32600,s,e,n);this.methodName=o;this.innerError=n;}},z=class extends c{constructor(o,s,e,n){super(o,-32601,s,e,n);this.methodName=o;this.innerError=n;}},W=class extends c{constructor(o,s,e,n){super(o,-32602,s,e,n);this.methodName=o;this.innerError=n;}},G=class extends c{constructor(o,s,e,n){super(o,-32603,s,e,n);this.methodName=o;this.innerError=n;}},Q=class extends c{constructor(o,s,e,n){super(o,-32e3,s,e,n);this.methodName=o;this.innerError=n;}};var T=class extends r{};var X=class extends r{},Y=class extends r{},Z=class extends r{};var _=class extends r{},A=class extends r{},q=class extends r{};var B=class extends r{};var H=class extends r{},L=class extends r{},M=class extends r{},N=class extends r{};var J=class extends r{}; | ||
exports.CannotFindTransaction = J; | ||
exports.CannotFindTransaction = N; | ||
exports.CertificateSignatureMismatch = u; | ||
@@ -19,4 +19,4 @@ exports.ContractCallError = l; | ||
exports.InvalidAddress = d; | ||
exports.InvalidBloom = D; | ||
exports.InvalidBloomParams = g; | ||
exports.InvalidBloom = g; | ||
exports.InvalidBloomParams = D; | ||
exports.InvalidCommandLineArguments = X; | ||
@@ -31,3 +31,3 @@ exports.InvalidConfigurationFile = Z; | ||
exports.InvalidKeystoreParams = k; | ||
exports.InvalidOperation = M; | ||
exports.InvalidOperation = J; | ||
exports.InvalidRLP = T; | ||
@@ -43,5 +43,5 @@ exports.InvalidSecp256k1MessageHash = A; | ||
exports.JSONRPCParseError = $; | ||
exports.JSONRPCProviderError = p; | ||
exports.JSONRPCProviderError = c; | ||
exports.JSONRPCServerError = Q; | ||
exports.NotDelegatedTransaction = N; | ||
exports.NotDelegatedTransaction = M; | ||
exports.PollExecution = K; | ||
@@ -56,2 +56,2 @@ exports.ProviderMethodError = S; | ||
exports.errors = R; | ||
exports.stringifyData = c; | ||
exports.stringifyData = p; |
{ | ||
"name": "@vechain/sdk-errors", | ||
"version": "1.0.0-rc.1", | ||
"version": "1.0.0-rc.2", | ||
"description": "This module is dedicated to managing and customizing errors within the VeChain SDK", | ||
@@ -5,0 +5,0 @@ "author": "VeChain Foundation", |
/** | ||
* Function to stringify data correctly. | ||
* Some data types like Error, Map, Set, etc. are not stringified correctly by JSON.stringify. | ||
* This function handles those cases and avoid circular references. | ||
* This function handles those cases and avoids circular references. | ||
* | ||
@@ -70,2 +70,7 @@ * @param data - The data to be stringified. | ||
): string { | ||
const internalErrorMessage = | ||
innerError?.message !== undefined | ||
? `\n-Internal error: \n\t${innerError.message}` | ||
: ''; | ||
return ( | ||
@@ -75,3 +80,3 @@ `Method '${methodName}' failed.` + | ||
`\n-Parameters: \n\t${stringifyData(inputData)}` + | ||
`${innerError?.message !== undefined ? `\n-Internal error: \n\t${innerError.message}` : ''}` | ||
internalErrorMessage | ||
); | ||
@@ -78,0 +83,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Unstable ownership
Supply chain riskA new collaborator has begun publishing package versions. Package stability and security risk may be elevated.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
71550
1222
1