forked from boa-dev/temporal
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror.rs
More file actions
36 lines (32 loc) · 827 Bytes
/
error.rs
File metadata and controls
36 lines (32 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#[diplomat::bridge]
#[diplomat::abi_rename = "temporal_rs_{0}"]
#[diplomat::attr(auto, namespace = "temporal_rs")]
pub mod ffi {
#[diplomat::enum_convert(temporal_rs::error::ErrorKind)]
pub enum ErrorKind {
Generic,
Type,
Range,
Syntax,
Assert,
}
// In the future we might turn this into an opaque type with a msg() field
pub struct TemporalError {
pub kind: ErrorKind,
}
impl TemporalError {
// internal
pub(crate) fn syntax() -> Self {
TemporalError {
kind: ErrorKind::Syntax,
}
}
}
}
impl From<temporal_rs::TemporalError> for ffi::TemporalError {
fn from(other: temporal_rs::TemporalError) -> Self {
Self {
kind: other.kind().into(),
}
}
}