Reference
?

ErrorCode

Type
The codes a MindStudioError carries when a write fails.

The code on a MindStudioError thrown by a write, so you can branch on the failure instead of parsing a message. Both Query and Mutation expose .catch, so you can inspect err.code on a single call, for example treating no_unique_constraint differently from a genuine conflict.

ErrorCode.ts
type ErrorCode =
  | 'insert_failed'
  | 'row_not_found'
  | 'missing_conflict_key'
  | 'no_unique_constraint'
Fields
'insert_failed'
push produced no row (500).
'row_not_found'
update targeted an id that does not exist (404).
'missing_conflict_key'
upsert data omitted the conflict column (400).
'no_unique_constraint'
upsert named a key with no matching unique constraint on the table (400).
Branch on the code
try {
  await Users.upsert('email', data);
} catch (err) {
  if (err.code === 'no_unique_constraint') { /* ... */ }
  throw err;
}