From 3868e32b9216e14247e0534061d1d02f3b8ab65d Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Sun, 20 Nov 2016 19:38:11 +0100 Subject: [PATCH] Show detailed error message if writing tags fails --- NEWS | 1 + src/actions.cpp | 4 ++-- src/tag_editor.cpp | 4 ++-- src/tiny_tag_editor.cpp | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 754b5919..0b61a430 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,7 @@ ncmpcpp-0.8 (????-??-??) * The list of lyrics fetchers can now be set via configuration file. * Lyrics can now be fetched for songs with no tags. * libcurl dependency is no longer optional. +* When an attempt to write tags fails, show detailed error message. ncmpcpp-0.7.7 (2016-10-31) * Fixed compilation on 32bit platforms. diff --git a/src/actions.cpp b/src/actions.cpp index 8f35b70a..699efcaf 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -1392,8 +1392,8 @@ void EditLibraryTag::run() if (!Tags::write(ms)) { success = false; - const char msg[] = "Error while updating tags in \"%1%\""; - Statusbar::printf(msg, wideShorten(ms.getURI(), COLS-const_strlen(msg))); + Statusbar::printf("Error while writing tags to \"%1%\": %2%", + ms.getName(), strerror(errno)); s.finish(); break; } diff --git a/src/tag_editor.cpp b/src/tag_editor.cpp index c77e1d0a..3dcaac5f 100644 --- a/src/tag_editor.cpp +++ b/src/tag_editor.cpp @@ -806,8 +806,8 @@ void TagEditor::runAction() Statusbar::printf("Writing tags in \"%1%\"...", (*it)->getName()); if (!Tags::write(**it)) { - const char msg[] = "Error while writing tags in \"%1%\""; - Statusbar::printf(msg, wideShorten((*it)->getURI(), COLS-const_strlen(msg)).c_str()); + Statusbar::printf("Error while writing tags to \"%1%\": %2%", + (*it)->getName(), strerror(errno)); success = 0; break; } diff --git a/src/tiny_tag_editor.cpp b/src/tiny_tag_editor.cpp index 9bbc8d2e..2abdf08a 100644 --- a/src/tiny_tag_editor.cpp +++ b/src/tiny_tag_editor.cpp @@ -172,7 +172,7 @@ void TinyTagEditor::runAction() } } else - Statusbar::print("Error while writing tags"); + Statusbar::printf("Error while writing tags: %1%", strerror(errno)); } if (option > 21) m_previous_screen->switchTo();