From b0d5b23227bfb8437fbce4fce882d55f675fc3db Mon Sep 17 00:00:00 2001 From: Michael Keller Date: Wed, 14 Jun 2023 12:48:56 +1200 Subject: [PATCH] Desktop: Add Meaningful Error Messages for libdivecomputer Dump. Add meaningful error messages when creating a libdivecomputer dump. In particular show if creating a dump is not supported on the dive computer that is used. Signed-off-by: Michael Keller --- core/libdivecomputer.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/core/libdivecomputer.c b/core/libdivecomputer.c index c5031cb52..bc4d06210 100644 --- a/core/libdivecomputer.c +++ b/core/libdivecomputer.c @@ -1138,13 +1138,23 @@ static const char *do_device_import(device_data_t *data) } dc_buffer_free(buffer); + + if (rc != DC_STATUS_SUCCESS) { + progress_bar_fraction = 0.0; + + if (rc == DC_STATUS_UNSUPPORTED) + return translate("gettextFromC", "Dumping not supported on this device"); + + return translate("gettextFromC", "Dive data dumping error"); + } } else { rc = dc_device_foreach(device, dive_cb, data); - } - if (rc != DC_STATUS_SUCCESS) { - progress_bar_fraction = 0.0; - return translate("gettextFromC", "Dive data import error"); + if (rc != DC_STATUS_SUCCESS) { + progress_bar_fraction = 0.0; + + return translate("gettextFromC", "Dive data import error"); + } } /* All good */