You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to react to exception where the unique field is already present with given value.
In my unit tests I get following error:
ResponseError: There was a problem with the database: Database index uniqueFieldThatIsUniqueUnitTestalready contains 'some-unique-value', with recordunitTests:qrogd6im2hvocl8ygdq6 at Surreal.create (node_modules/surrealdb/dist/index.cjs:1:51547) at processTicksAndRejections (node:internal/process/task_queues:105:5) at async SurrealDBPersister.create (/src/lib/surrealdb/surrealdb.persister.ts:19:31) at async /libs/persister/__tests__/surrealdb/surrealdb.persister.spec.ts:88:23
and I see two problems here.
First, this is some generic error which is kind of bearable to handle. But this error is missing the name of the field which violates the unique constraint, making it impossible to figure which one is breaking the constraint.
Is there any way around?
How do you handle it?
I use create(thing: Table | string, data?: U); method.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm trying to react to exception where the unique field is already present with given value.
In my unit tests I get following error:
ResponseError: There was a problem with the database: Database index
uniqueFieldThatIsUniqueUnitTestalready contains 'some-unique-value', with record
unitTests:qrogd6im2hvocl8ygdq6at Surreal.create (node_modules/surrealdb/dist/index.cjs:1:51547) at processTicksAndRejections (node:internal/process/task_queues:105:5) at async SurrealDBPersister.create (/src/lib/surrealdb/surrealdb.persister.ts:19:31) at async /libs/persister/__tests__/surrealdb/surrealdb.persister.spec.ts:88:23
and I see two problems here.
First, this is some generic error which is kind of bearable to handle. But this error is missing the name of the field which violates the unique constraint, making it impossible to figure which one is breaking the constraint.
Is there any way around?
How do you handle it?
I use
create(thing: Table | string, data?: U);
method.Beta Was this translation helpful? Give feedback.
All reactions