Comments (4)
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.
I'm having the same issue on my end, works in the shell but the same error from the js driver.
from fauna-js.
I figured it out in my case, if you look at the documentation on site the example looks like this:
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.
@macmv thx for letting me know about the queryInfo.summary
.
from fauna-js.
Related Issues (20)
- Timeout during query merge HOT 9
- Support Vercel Edge environment HOT 6
- Errors in examples HOT 1
- [Feature Request]: Have a utility function to parse the query result into valid JSON object HOT 6
- Error on client.close() HOT 3
- Bug on translating numbers to floats. HOT 1
- Typescript compilation error in client.d.ts HOT 2
- FAUNA_ENDPOINT Environment Variable Is Not Honored HOT 1
- Does not work with Fauna Dev, unknown format error HOT 3
- Docs: Would be nice to add an example on how to handler abort() errors
- Error: The network connection encountered a problem HOT 2
- NetworkError: The network connection encountered a problem - using Bun HOT 6
- Response Object HOT 1
- [Feature request] Typegen/codegen
- Next dev hot reload warnings HOT 3
- Response type for document doesn't include fields added by Fauna HOT 2
- Add `ttl` as an optional field to the Document class
- Pagination Helper: it only works when format option is set to tagged HOT 2
- FQL Objects with nested queries HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fauna-js.