medea_jason/platform/dart/
error.rs1use dart_sys::Dart_Handle;
4use derive_more::with_trait::Display;
5
6use super::utils::handle::DartHandle;
7
8#[derive(Clone, Debug, Display, Eq, PartialEq)]
10#[display("DartPlatformError")]
11pub struct Error(DartHandle);
12
13impl Error {
14 #[must_use]
22 pub unsafe fn from_handle(h: Dart_Handle) -> Self {
23 Self(unsafe { DartHandle::new(h) })
24 }
25
26 #[must_use]
28 pub fn get_handle(&self) -> Dart_Handle {
29 self.0.get()
30 }
31
32 #[must_use]
34 pub fn name(&self) -> String {
35 self.0.name()
36 }
37
38 #[must_use]
40 pub fn message(&self) -> String {
41 self.0.to_string()
42 }
43}