diff --git a/CHANGELOG.md b/CHANGELOG.md index b8c997da0e..bf454da2fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ dc_stop_io(). dc_start_io() can now be called at any time without harm. #4138 - More accurate maybe_add_bcc_self device message text #4175 +- LogExt::log_err now calls Context::set_last_error so that the FFI + can use this and have consistent dc_get_last_error() reporting. #4187 ### Fixes - Fix segmentation fault if `dc_context_unref()` is called during diff --git a/deltachat-ffi/src/lib.rs b/deltachat-ffi/src/lib.rs index 8101eda93f..e9bda225de 100644 --- a/deltachat-ffi/src/lib.rs +++ b/deltachat-ffi/src/lib.rs @@ -4178,7 +4178,9 @@ pub unsafe extern "C" fn dc_backup_provider_get_qr( return "".strdup(); } let ffi_provider = &*provider; + let ctx = &*ffi_provider.context; deltachat::qr::format_backup(&ffi_provider.provider.qr()) + .log_err(ctx, "BackupProvider get_qr failed") .unwrap_or_default() .strdup() } @@ -4195,6 +4197,7 @@ pub unsafe extern "C" fn dc_backup_provider_get_qr_svg( let ctx = &*ffi_provider.context; let provider = &ffi_provider.provider; block_on(generate_backup_qr(ctx, &provider.qr())) + .log_err(ctx, "BackupProvider get_qr_svg failed") .unwrap_or_default() .strdup() } @@ -4209,7 +4212,7 @@ pub unsafe extern "C" fn dc_backup_provider_wait(provider: *mut dc_backup_provid let ctx = &*ffi_provider.context; let provider = &mut ffi_provider.provider; block_on(provider) - .log_err(ctx, "Failed to join provider") + .log_err(ctx, "Failed to await BackupProvider") .ok(); } diff --git a/src/log.rs b/src/log.rs index c755484e61..3611c3c747 100644 --- a/src/log.rs +++ b/src/log.rs @@ -147,6 +147,7 @@ impl LogExt for Result { ); // We can't use the warn!() macro here as the file!() and line!() macros // don't work with #[track_caller] + context.set_last_error(&full); context.emit_event(crate::EventType::Warning(full)); }; self