0.6.1: add AppError support for optional error and data
This commit is contained in:
parent
c9f5ec2e42
commit
9114c88110
|
@ -215,7 +215,7 @@ checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libcwtch"
|
name = "libcwtch"
|
||||||
version = "0.6.0"
|
version = "0.6.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bindgen",
|
"bindgen",
|
||||||
"chrono",
|
"chrono",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "libcwtch"
|
name = "libcwtch"
|
||||||
version = "0.6.0"
|
version = "0.6.1"
|
||||||
authors = ["Dan Ballard <dan@mindstab.net>"]
|
authors = ["Dan Ballard <dan@mindstab.net>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
license = "MIT"
|
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
|
/// Cwtch had an error at the app level (not profile level), usually in response to an API call
|
||||||
AppError {
|
AppError {
|
||||||
/// details of the app error that occured
|
/// 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
|
/// Global settings being emited from lcg, usually in response to them being sent to be saved by client
|
||||||
UpdateGlobalSettings {
|
UpdateGlobalSettings {
|
||||||
|
@ -655,7 +657,14 @@ impl From<&CwtchEvent> for Event {
|
||||||
},
|
},
|
||||||
"PeerError" => Event::PeerError { error: cwtch_event.data["Error"].clone() },
|
"PeerError" => Event::PeerError { error: cwtch_event.data["Error"].clone() },
|
||||||
"AppError" => Event::AppError {
|
"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 {
|
"ContactCreated" => Event::ContactCreated {
|
||||||
profile_id: cwtch_event.data["ProfileOnion"].clone().into(),
|
profile_id: cwtch_event.data["ProfileOnion"].clone().into(),
|
||||||
|
|
Loading…
Reference in New Issue