From f1ff45ecae16b0468ee4523ed358c2b9874402a9 Mon Sep 17 00:00:00 2001 From: goodvibes2 Date: Fri, 12 Jun 2020 15:20:57 +1000 Subject: [PATCH] Bug 796993 - Get Quotes: Err msg if Alpha Vantage API key needed AlphaVantage API Key is needed for all currency quotes and stock quotes with source 'alphavantage' or 'vanguard' or multi sources that include 'alphavantage'. Give an error message instead of failing with no reason. --- gnucash/price-quotes.scm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gnucash/price-quotes.scm b/gnucash/price-quotes.scm index c562987e9f..c73df2d02f 100644 --- a/gnucash/price-quotes.scm +++ b/gnucash/price-quotes.scm @@ -128,6 +128,9 @@ (catch #t (lambda () (gnc:debug "handling-request: " request) + (and (member (car request) '("currency" "alphavantage" "vanguard")) + (not (getenv "ALPHAVANTAGE_API_KEY")) + (throw 'need-alphavantage-key)) ;; we need to display the first element (the method, ;; so it won't be quoted) and then write the rest (with-output-to-port (fdes->outport (gnc-process-get-fd quoter 0)) @@ -447,6 +450,11 @@ (show-error (N_ "You are missing some needed Perl libraries. Run 'gnc-fq-update' as root to install them."))) + ((memq 'need-alphavantage-key fq-results) + (set! keep-going? #f) + (show-error (N_ "ERROR: ALPHAVANTAGE_API_KEY must be set for currency \ ++ quotes; see https://wiki.gnucash.org/wiki/Online_Quotes#Source_Alphavantage.2C_US"))) + ((memq 'system-error fq-results) (set! keep-going? #f) (show-error (N_ "There was a system error while retrieving the price quotes.")))