Skip to main content

paper_cache/
error.rs

1/*
2 * Copyright (c) Kia Shakiba
3 *
4 * This source code is licensed under the GNU AGPLv3 license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8use thiserror::Error;
9
10#[derive(Debug, PartialEq, Error)]
11pub enum CacheError {
12	#[error("internal error")]
13	Internal,
14
15	#[error("the key was not found in the cache")]
16	KeyNotFound,
17
18	#[error("the value size cannot be zero")]
19	ZeroValueSize,
20
21	#[error("the value size cannot exceed the cache size")]
22	ExceedingValueSize,
23
24	#[error("the cache size cannot be zero")]
25	ZeroCacheSize,
26
27	#[error("must configure at least one eviction policy")]
28	EmptyPolicies,
29
30	#[error("cannot configure auto eviction policy")]
31	ConfiguredAutoPolicy,
32
33	#[error("cannot configure duplicate eviction policies")]
34	DuplicatePolicies,
35
36	#[error("unconfigured policy")]
37	UnconfiguredPolicy,
38
39	#[error("invalid policy")]
40	InvalidPolicy,
41}