diff options
author | Leo K <crowlkats@toaxl.com> | 2021-06-05 19:30:20 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-05 19:30:20 +0200 |
commit | 083f5c345445af4e434281c37817e12249d7553d (patch) | |
tree | 2db46d622283ab37182ca988ecb0712dc11af6e8 /extensions/webstorage/lib.rs | |
parent | 706b75d7421a33a54f51ceafc0747be4a646c707 (diff) |
refactor(crypto): validate max random bytes in Rust (#10857)
Diffstat (limited to 'extensions/webstorage/lib.rs')
-rw-r--r-- | extensions/webstorage/lib.rs | 34 |
1 files changed, 4 insertions, 30 deletions
diff --git a/extensions/webstorage/lib.rs b/extensions/webstorage/lib.rs index d2170890e..595a6b7dd 100644 --- a/extensions/webstorage/lib.rs +++ b/extensions/webstorage/lib.rs @@ -138,8 +138,10 @@ pub fn op_webstorage_set( if size >= 5000000 { return Err( - DomExceptionQuotaExceededError::new("Exceeded maximum storage size") - .into(), + deno_web::DomExceptionQuotaExceededError::new( + "Exceeded maximum storage size", + ) + .into(), ); } @@ -213,34 +215,6 @@ pub fn op_webstorage_iterate_keys( } #[derive(Debug)] -pub struct DomExceptionQuotaExceededError { - pub msg: String, -} - -impl DomExceptionQuotaExceededError { - pub fn new(msg: &str) -> Self { - DomExceptionQuotaExceededError { - msg: msg.to_string(), - } - } -} - -impl fmt::Display for DomExceptionQuotaExceededError { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - f.pad(&self.msg) - } -} - -impl std::error::Error for DomExceptionQuotaExceededError {} - -pub fn get_quota_exceeded_error_class_name( - e: &AnyError, -) -> Option<&'static str> { - e.downcast_ref::<DomExceptionQuotaExceededError>() - .map(|_| "DOMExceptionQuotaExceededError") -} - -#[derive(Debug)] pub struct DomExceptionNotSupportedError { pub msg: String, } |