diff --git a/package-lock.json b/package-lock.json index 786375d3..eb52cd2d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "zkapp-cli", - "version": "0.4.19", + "version": "0.4.20", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "zkapp-cli", - "version": "0.4.19", + "version": "0.4.20", "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index caa8b1e2..80d5feb7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "zkapp-cli", - "version": "0.4.19", + "version": "0.4.20", "description": "CLI to create a zkApp (\"zero-knowledge app\") for Mina Protocol.", "keywords": [ "cli", diff --git a/src/lib/deploy.js b/src/lib/deploy.js index 929ec184..f2ebf888 100644 --- a/src/lib/deploy.js +++ b/src/lib/deploy.js @@ -7,6 +7,7 @@ const { table, getBorderCharacters } = require('table'); const glob = require('fast-glob'); const { step } = require('./helpers'); const fetch = require('node-fetch'); +const util = require('util'); const { red, green, bold, reset } = require('chalk'); const log = console.log; @@ -419,7 +420,7 @@ async function deploy({ alias, yes }) { if (!txn || txn?.kind === 'error') { // Note that the thrown error object is already console logged via step(). - log(red(getErrorMessage(txn.message ?? []))); + log(red(getErrorMessage(txn))); await shutdown(); return; } @@ -563,7 +564,11 @@ function getAccountQuery(publicKey) { }`; } -function getErrorMessage(errors) { +function getErrorMessage(error) { + let errors = error?.message ?? []; + if (errors.length === 0) { + return `Failed to send transaction. Unknown error: ${util.format(error)}`; + } let errorMessage = ' Failed to send transaction to relayer. Errors: ' + errors.map((e) => e.message);