mirror of
https://github.com/denoland/deno.git
synced 2025-03-10 06:07:03 -04:00

- adding `DOMExceptionInvalidStateError` in global due to handling not supported image format - animation image is not supported currently
30 lines
721 B
Rust
30 lines
721 B
Rust
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
|
|
use deno_core::error::AnyError;
|
|
use std::fmt;
|
|
|
|
#[derive(Debug)]
|
|
pub struct DOMExceptionInvalidStateError {
|
|
pub msg: String,
|
|
}
|
|
|
|
impl DOMExceptionInvalidStateError {
|
|
pub fn new(msg: &str) -> Self {
|
|
DOMExceptionInvalidStateError {
|
|
msg: msg.to_string(),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl fmt::Display for DOMExceptionInvalidStateError {
|
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
|
f.pad(&self.msg)
|
|
}
|
|
}
|
|
|
|
impl std::error::Error for DOMExceptionInvalidStateError {}
|
|
|
|
pub fn get_error_class_name(e: &AnyError) -> Option<&'static str> {
|
|
e.downcast_ref::<DOMExceptionInvalidStateError>()
|
|
.map(|_| "DOMExceptionInvalidStateError")
|
|
}
|