Query Logging
Enable query logging to print every SQL statement IlanaORM executes, along with its execution time.Via config file (recommended)
Enable only in development
Programmatically
Output
Inspect a single query
UsetoSql() to get the raw SQL string without executing it:
ModelNotFoundException
findOrFail() and firstOrFail() throw a ModelNotFoundException when no record is found — instead of a generic Error. This lets you catch it specifically and return a clean 404.
toResponse() — HTTP-ready error object
Call toResponse() on the exception to get a plain { status, message } object you can pass directly to your HTTP framework:
Global Express error handler
Catch it once across all routes:Properties
| Property | Type | Description |
|---|---|---|
message | string | Human-readable message e.g. "User with id 5 not found" |
name | string | Always 'ModelNotFoundException' |
model | string | The model class name e.g. 'User' |
id | any | The ID passed to findOrFail(), or undefined for firstOrFail() |
