Skip to content

Commit

Permalink
fix(oss-808): error message for eval cmd (#118)
Browse files Browse the repository at this point in the history
* fix(oss-808): error message for eval cmd

* rm unused fn
  • Loading branch information
fireridlle authored Aug 19, 2021
1 parent 7995a44 commit 2a7b6e9
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions src/commands/eval.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,6 @@ const { readFile, runQueries, errorOut, writeFile } = require('../lib/misc.js')

const EVAL_OUTPUT_FORMATS = ['json', 'shell']

function infoMessage(err) {
const fe = util.inspect(err.faunaError, { depth: null })
return `
The following query failed:
${err.exp}
With error message:
${fe}
Query number:
${err.queryNumber}
`
}

/**
* Write json encoded output
*
Expand Down Expand Up @@ -68,8 +54,13 @@ function performQuery(client, fqlQuery, outputFile, outputFormat) {
.then(function (response) {
return writeFormattedOutput(outputFile, response, outputFormat)
})
.catch(function (err) {
errorOut(infoMessage(err), 1)
.catch(function (error) {
console.log(
util.inspect(JSON.parse(error.faunaError.requestResult.responseRaw), {
depth: null,
compact: false,
})
)
})
}

Expand Down

0 comments on commit 2a7b6e9

Please sign in to comment.