mirror of
https://github.com/denoland/deno.git
synced 2025-03-09 21:57:40 -04:00
31 lines
721 B
Rust
31 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")
|
||
|
}
|