Skip to main content

Error Handling

MiftahDB uses result types to handle errors. The result type includes a boolean indicating whether the operation was successful and the data returned by the operation, or an error if the operation failed.

const result = db.get("user:1234");
if (result.success) {
console.log(`User: ${result.data}`);
} else {
console.log(result.error.message);
}