Back

Error Handling

  • 0
  • Databases
Smiley
19 Nov, 2023, 20:43

How can I handle Conflict errors 'if a document already exists (in collection) then I want to edit it instead'

TL;DR
The user is asking for help with error handling. They want to know how to handle conflict errors when a document already exists. The solution is to make an update API call instead of a create call.
Drake
19 Nov, 2023, 20:50

Make an update API call instead of create

Smiley
19 Nov, 2023, 20:54
Smiley
19 Nov, 2023, 20:54

Is this the right way?

Drake
19 Nov, 2023, 20:55

No... You're calling create document...

Smiley
19 Nov, 2023, 20:56

Yes I did, but then If the error == 409 (conflict) then it'll trigger the other function

Drake
19 Nov, 2023, 20:59

Sorry I don't see any update document call

Smiley
19 Nov, 2023, 21:00

I'll call it here

Drake
19 Nov, 2023, 21:00

Okay sure

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more