Skip to main content

Errors

The TypeScript implementation exports three public error classes:

  • CSDBError: base class for CSDB library errors.
  • ValidationError: invalid file structure, metadata, schema, values, constraints, or relationships.
  • SQLError: unsupported or invalid SQL syntax.

Python should expose the same hierarchy:

class CSDBError(Exception): ...
class ValidationError(CSDBError): ...
class SQLError(CSDBError): ...

Typical handling:

try {
db.validate();
} catch (error) {
if (error instanceof ValidationError) {
console.error(error.message);
}
}

The CSDB server maps errors to HTTP status codes and a stable response body. It never returns a TypeScript stack trace to the client.

{
"ok": false,
"error": {
"code": "VALIDATION_ERROR",
"message": "Required column \"id\" cannot be null."
},
"requestId": "req_01J..."
}
ErrorHTTP statusJSON code
Malformed JSON or command envelope400INVALID_REQUEST
Unknown database or table404NOT_FOUND
SQLError422SQL_ERROR
ValidationError422VALIDATION_ERROR
Unexpected server failure500INTERNAL_ERROR