-
Notifications
You must be signed in to change notification settings - Fork 228
/
Copy pathcrashtest.udl
53 lines (39 loc) · 1.6 KB
/
crashtest.udl
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// # Crash Test Helper APIs
//
// The `crashtest` component offers a little helper API that lets you deliberately
// crash the application. It's intended to help developers test the crash-handling
// and crash-reporting capabilities of their app.
namespace crashtest {
/// Trigger a hard abort inside the Rust code.
///
/// This function simulates some kind of uncatchable illegal operation
/// performed inside the Rust code. After calling this function you should
/// expect your application to be halted with e.g. a `SIGABRT` or similar.
///
void trigger_rust_abort();
/// Trigger a panic inside the Rust code.
///
/// This function simulates the occurrence of an unexpected state inside
/// the Rust code that causes it to panic. We build our Rust components to
/// unwind on panic, so after calling this function through the foreign
/// language bindings, you should expect it to intercept the panic translate
/// it into some foreign-language-appropriate equivalent:
///
/// - In Kotlin, it will throw an exception.
/// - In Swift, it will fail with a `try!` runtime error.
///
void trigger_rust_panic();
/// Trigger an error inside the Rust code.
///
/// This function simulates the occurrence of an expected error inside
/// the Rust code. You should expect calling this function to throw the
/// foreign-language representation of the [`CrashTestError`] class.
///
[Throws=CrashTestError]
void trigger_rust_error();
};
/// An error that can be returned from Rust code.
[Error]
enum CrashTestError {
"ErrorFromTheRustCode",
};