From 6a98eade079e201175dddb691e29f6b12468d9b4 Mon Sep 17 00:00:00 2001 From: Floris Bruynooghe Date: Thu, 13 Feb 2020 22:28:14 +0100 Subject: [PATCH] Remove the error method from the ffi No ffi method should be reporting errors to the user. That's exclusively the domain of core. All errors in the ffi are programing errors. --- deltachat-ffi/src/lib.rs | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index a37d84db4..e19722c95 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -86,17 +86,6 @@ pub type dc_callback_t = pub type dc_context_t = ContextWrapper; impl ContextWrapper { - /// Log an error on the FFI context. - /// - /// As soon as a [ContextWrapper] exist it can be used to log an - /// error using the callback, even before [dc_context_open] is - /// called and an actual [Context] exists. - /// - /// This function makes it easy to log an error. - unsafe fn error(&self, msg: &str) { - self.translate_cb(Event::Error(msg.to_string())); - } - /// Log a warning on the FFI context. /// /// Like [error] but logs as a warning which only goes to the @@ -367,7 +356,7 @@ pub unsafe extern "C" fn dc_set_config( }) .unwrap_or(0), Err(_) => { - ffi_context.error("dc_set_config(): invalid key"); + ffi_context.warning("dc_set_config(): invalid key"); 0 } } @@ -388,7 +377,7 @@ pub unsafe extern "C" fn dc_get_config( .with_inner(|ctx| ctx.get_config(key).unwrap_or_default().strdup()) .unwrap_or_else(|_| "".strdup()), Err(_) => { - ffi_context.error("dc_get_config(): invalid key"); + ffi_context.warning("dc_get_config(): invalid key"); "".strdup() } }