Open haikyuu opened 2 years ago
another one
EdgeQLSyntaxError: character U+202E is not allowed, use escaped form \u202e
Can you show some code examples here? Ideally TypeScript would catch these errors at compile time (at least the first one).
@colinhacks Yes The following throws that error
const profile = '{"type": "json"}'
const user = { github_profile: profile }
const iq = e.insert(e.User, user)
It's fixed by using e.json(profile)
instead
The second one happened because of a right to left override character which is not supported without using the escaped form. You can reproduce using this
edgedb> select 'rekcäH nitraM'
error: EdgeQLSyntaxError: character U+202E is not allowed, use escaped form \u202e
┌─ query:1:8
│
1 │ select 'rekcäH nitraM';
│ ^ error
A better error would maybe include the full generated query?
I was trying to insert a user using e.insert(e.User, user)
Actual error that the query builder throws
EdgeQLSyntaxError: character U+202E is not allowed, use escaped form \u202e
Another one
InvalidValueError: cannot extract elements from a scalar
at RawConnection._parseErrorMessage (/Users/abdellah/workspace/scrimba/scrimba-edge/node_modules/edgedb/dist/rawConn.js:371:21)
at RawConnection._executeFlow (/Users/abdellah/workspace/scrimba/scrimba-edge/node_modules/edgedb/dist/rawConn.js:861:34)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RawConnection.fetch (/Users/abdellah/workspace/scrimba/scrimba-edge/node_modules/edgedb/dist/rawConn.js:981:13)
at async Transaction._runOp (/Users/abdellah/workspace/scrimba/scrimba-edge/node_modules/edgedb/dist/transaction.js:94:20)
at null.<anonymous> (/Users/abdellah/workspace/scrimba/scrimba-edge/dbschema/pg_migrations/users.imba:148:24)
at async ClientConnectionHolder.transaction (/Users/abdellah/workspace/scrimba/scrimba-edge/node_modules/edgedb/dist/client.js:135:26)
at async Client.transaction (/Users/abdellah/workspace/scrimba/scrimba-edge/node_modules/edgedb/dist/client.js:450:20)
at null.run (/Users/abdellah/workspace/scrimba/scrimba-edge/dbschema/pg_migrations/users.imba:101:8)
This happened on a query like so (but with a more complex type)
const query = e.params(
{raw_data: e.array(e.tuple({title: e.str}))},
params =>
e.for(e.array_unpack(params.raw_data), item =>
e.insert(e.Movie, {
title: item.title,
})
)
);
console.log(query.toEdgeQL());
const result = await query.run(client, {
raw_data: [
{title: "The Marvels"},
{title: "Blade"},
{title: "Doctor Strange and the Multiverse of Madness"},
],
});
A better error
Invalid value for type std::json at property metadata in default::User