API reference › @evolu/common › Result › Err
Defined in: packages/common/src/Result.ts:265
An error Result.
The error property can be any type that describes the error. For domain
errors, use a plain object with a type field for discrimination.
Example
interface NotFoundError extends Typed<"NotFoundError"> {
readonly id: string;
}
const findUser = (id: string): Result<User, NotFoundError> => {
const user = users.get(id);
if (user == null) return err({ type: "NotFoundError", id });
return ok(user);
};
Properties
error
readonly error: E;
Defined in: packages/common/src/Result.ts:267
ok
readonly ok: false;
Defined in: packages/common/src/Result.ts:266