GithubHelp home page GithubHelp logo

Comments (4)

macmv avatar macmv commented on June 3, 2024 1

The error includes a queryInfo.summary field, which will include the more descriptive error (like what you would get on the dashboard). You can log this with a try catch:

try {
  client.query(...);
} catch (e) {
  console.error(e.queryInfo.summary);
}

The error message you're seeing is meant to be a one-line response, telling you the type of error that came back. So parse errors and typecheck errors just say "The query failed N validation checks," whereas something like an abort will fail with "The query aborted."

The summary is the error message you're looking for. I don't know how JS handles errors in general, and it looks like its a bit of a pain to log more fields on the actual error itself. We might be able to improve this slightly by making the message in the Error the summary, but I think that would conflict with existing behavior, and it would make the difference between the error message and summary less clear.

from fauna-js.

mrispoli24 avatar mrispoli24 commented on June 3, 2024

I'm having the same issue on my end, works in the shell but the same error from the js driver.

from fauna-js.

mrispoli24 avatar mrispoli24 commented on June 3, 2024

I figured it out in my case, if you look at the documentation on site the example looks like this:

image

Which might lead you to build a function that looks something like this in your code:

const collection_query = (collectionName: string) => fql`Collection.create({ name: "${collectionName}" })`;

However this throws the non-descript error above. You can fix this by removing the quotes around the name attribute and all works fine.

const collection_query = (collectionName: string) => fql`Collection.create({ name: ${collectionName} })`;

Hope this helps someone else...

from fauna-js.

BrunoQuaresma avatar BrunoQuaresma commented on June 3, 2024

@macmv thx for letting me know about the queryInfo.summary.

from fauna-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.