Repository navigation
Errors and Results
type CompileExecutionResult<T = any> = {
ok: boolean;
data?: T[];
error?: unknown[] | unknown;
};compile() returns a plan. When execute() succeeds, it returns { ok: true, data }. An execution error is caught and returned as { ok: false, error }.
Errors thrown during initial compilation or plan construction may occur before the result envelope exists, so callers should guard both compile and execute while the API is experimental.
try {
const plan = await compile(db, request, user, role, structure);
const result = await plan.execute();
if (!result.ok) return handleFailure(result.error);
return result.data;
} catch (error) {
return handleFailure(error);
}A QUERY phase returns an object with ok, collected data, and an optional array of errors. A TRANSACTION phase returns all results on commit or one error on rollback. A multi-phase request nests these phase results in top-level data.
The implementation throws generic Error instances for cases including:
- unknown table or field;
- missing endpoint;
- unsupported role or malformed permissions;
- empty permission set;
- unsupported operation, join type, operator, or phase mode;
- missing mutation data;
- invalid condition shape;
- rejected policy condition.
These messages are developer diagnostics, not a stable public API.
Map internal failures to a small API contract such as FORBIDDEN, INVALID_REQUEST, NOT_FOUND, and INTERNAL_ERROR. Do not infer authorization semantics from the message string in durable application logic.
Start Here
Learn & Build
- Learn VoidQL
- Build with VoidQL
- Query Operations
- Authorization Patterns
- Validation & Workflows
- Triggers & Extensibility
Use & Reference
Internals & Project