Alerting if there is conflict

I'm doing an insert and wanted to ask whether there is a specific error type that is returned when there is a conflict. Pseudo-code of what I would want
await db.insert(guild).values({ id: interaction.guildId })
.catch((error) => {
if (error.type === "conflict") {
alert("This already exists")
}
})
await db.insert(guild).values({ id: interaction.guildId })
.catch((error) => {
if (error.type === "conflict") {
alert("This already exists")
}
})
2 Replies
net-tech-
net-tech-OP16mo ago
bump
pandareaper
pandareaper16mo ago
in my experience, the error you get will be from whatever DB driver you are using under the hood, not drizzle

Did you find this page helpful?