Skip to main content

coil_core/browser/
error.rs

1use super::CookieProtection;
2use thiserror::Error;
3
4#[derive(Debug, Error, PartialEq, Eq)]
5pub enum BrowserSecurityError {
6    #[error("browser security operations require a non-empty secret")]
7    EmptySecret,
8    #[error("cookie policy expects {expected:?} protection but was used as {actual:?}")]
9    UnexpectedCookieProtection {
10        expected: CookieProtection,
11        actual: CookieProtection,
12    },
13    #[error("cookie value is not in the expected signed format")]
14    InvalidCookieFormat,
15    #[error("signed cookie failed verification")]
16    InvalidCookieSignature,
17    #[error("encrypted cookie is not in the expected format")]
18    InvalidEncryptedCookieFormat,
19    #[error("encrypted cookie failed decryption")]
20    InvalidEncryptedCookiePayload,
21    #[error("CSRF protection is disabled for this runtime")]
22    CsrfDisabled,
23    #[error("CSRF token is not in the expected format")]
24    InvalidCsrfTokenFormat,
25}