0.6.1: add AppError support for optional error and data #24
|
@ -215,7 +215,7 @@ checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
|
|||
|
||||
[[package]]
|
||||
name = "libcwtch"
|
||||
version = "0.6.0"
|
||||
version = "0.6.1"
|
||||
dependencies = [
|
||||
"bindgen",
|
||||
"chrono",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "libcwtch"
|
||||
version = "0.6.0"
|
||||
version = "0.6.1"
|
||||
authors = ["Dan Ballard <dan@mindstab.net>"]
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
|
|
13
src/event.rs
13
src/event.rs
|
@ -252,7 +252,9 @@ pub enum Event {
|
|||
/// Cwtch had an error at the app level (not profile level), usually in response to an API call
|
||||
AppError {
|
||||
/// details of the app error that occured
|
||||
error: String
|
||||
error: String,
|
||||
/// possible data about the error
|
||||
data: String
|
||||
},
|
||||
/// Global settings being emited from lcg, usually in response to them being sent to be saved by client
|
||||
UpdateGlobalSettings {
|
||||
|
@ -655,7 +657,14 @@ impl From<&CwtchEvent> for Event {
|
|||
},
|
||||
"PeerError" => Event::PeerError { error: cwtch_event.data["Error"].clone() },
|
||||
"AppError" => Event::AppError {
|
||||
error: cwtch_event.data["Error"].clone(),
|
||||
error: match cwtch_event.data.contains_key("Error") {
|
||||
true => cwtch_event.data["Error"].clone(),
|
||||
false => "".to_string()
|
||||
},
|
||||
data: match cwtch_event.data.contains_key("Data") {
|
||||
true => cwtch_event.data["Data"].clone(),
|
||||
false => "".to_string()
|
||||
}
|
||||
},
|
||||
"ContactCreated" => Event::ContactCreated {
|
||||
profile_id: cwtch_event.data["ProfileOnion"].clone().into(),
|
||||
|
|
Loading…
Reference in New Issue