mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
[price-quotes] Report quote fetch failures to the user.
This commit is contained in:
parent
4c47e91180
commit
6ffb0bb633
@ -564,6 +564,9 @@ gnc_prices_dialog_get_quotes_clicked (GtkWidget *widget, gpointer data)
|
||||
gnc_set_busy_cursor (NULL, TRUE);
|
||||
quotes.fetch (pdb_dialog->book);
|
||||
gnc_unset_busy_cursor (NULL);
|
||||
if (quotes.had_failures())
|
||||
gnc_warning_dialog(GTK_WINDOW(pdb_dialog->window), "%s",
|
||||
quotes.report_failures().c_str());
|
||||
}
|
||||
catch (const GncQuoteException& err)
|
||||
{
|
||||
|
@ -346,10 +346,12 @@ Gnucash::add_quotes (const bo_str& uri)
|
||||
gnc_quote_source_set_fq_installed (quotes.version().c_str(), quote_sources);
|
||||
g_list_free_full (quote_sources, g_free);
|
||||
quotes.fetch(qof_session_get_book(session));
|
||||
if (quotes.had_failures())
|
||||
std::cerr << quotes.report_failures() << std::endl;
|
||||
}
|
||||
catch (const GncQuoteException& err)
|
||||
{
|
||||
std::cerr << err.what() << std::endl;
|
||||
std::cerr << bl::translate("Price retrieval failed: ") << err.what() << std::endl;
|
||||
}
|
||||
qof_session_save(session, NULL);
|
||||
if (qof_session_get_error(session) != ERR_BACKEND_NO_ERR)
|
||||
|
@ -96,6 +96,7 @@ public:
|
||||
const std::string& version() noexcept { return m_version.empty() ? not_found : m_version; }
|
||||
const QuoteSources& sources() noexcept { return m_sources; }
|
||||
GList* sources_as_glist ();
|
||||
bool had_failures() noexcept { return !m_failures.empty(); }
|
||||
const QFVec& failures() noexcept;
|
||||
std::string report_failures() noexcept;
|
||||
|
||||
@ -821,6 +822,12 @@ GList* GncQuotes::sources_as_glist ()
|
||||
|
||||
GncQuotes::~GncQuotes() = default;
|
||||
|
||||
bool
|
||||
GncQuotes::had_failures() noexcept
|
||||
{
|
||||
return m_impl->had_failures();
|
||||
}
|
||||
|
||||
const QFVec&
|
||||
GncQuotes::failures() noexcept
|
||||
{
|
||||
|
@ -111,6 +111,12 @@ public:
|
||||
*/
|
||||
GList* sources_as_glist () ;
|
||||
|
||||
/** Report if there were quotes requested but not retrieved.
|
||||
*
|
||||
* @returns True if there were quote failures.
|
||||
*/
|
||||
bool had_failures() noexcept;
|
||||
|
||||
/** Report the commodities for which quotes were requested but not successfully retrieved.
|
||||
*
|
||||
* This does not include requested commodities that didn't have a quote source.
|
||||
|
Loading…
Reference in New Issue
Block a user