mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Catch errors in the execution of the finance-quote-helper script and
print a warning message. Allow stock index names to be passed to finance-quote-helper. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7623 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
9821b8879b
commit
235248a0f4
10
ChangeLog
10
ChangeLog
@ -1,3 +1,13 @@
|
||||
2002-12-04 David Hampton <hampton@employees.org>
|
||||
|
||||
* src/quotes/finance-quote-helper.in (schemify_quote): Allow stock
|
||||
index names to be passed though from gnucash to
|
||||
Finance::Quote. Necessary but not sufficient to solve #88118.
|
||||
|
||||
* src/scm/price-quotes.scm ((gnc:fq-get-quotes)): Beef up the
|
||||
error handling. Should now print a warning message if the price
|
||||
quote lookup fails, instead of crashing. #100186
|
||||
|
||||
2002-12-04 Derek Atkins <derek@ihtfp.com>
|
||||
|
||||
* src/register/ledger-core/split-register-p.h:
|
||||
|
@ -65,7 +65,7 @@ use FileHandle;
|
||||
|
||||
# For example:
|
||||
|
||||
# $ echo '(yahoo "CSCO" "JDSU")' | ./price-quote-helper
|
||||
# $ echo '(yahoo "CSCO" "JDSU" "^IXIC")' | ./finance-quote-helper
|
||||
# (("CSCO" (symbol . "CSCO")
|
||||
# (gnc:time-no-zone . "2001-03-13 19:27:00")
|
||||
# (last . 20.375)
|
||||
@ -73,12 +73,16 @@ use FileHandle;
|
||||
# ("JDSU" (symbol . "JDSU")
|
||||
# (gnc:time-no-zone . "2001-03-13 19:27:00")
|
||||
# (last . 23.5625)
|
||||
# (currency . "USD")))
|
||||
# (currency . "USD"))
|
||||
# ("^IXIC" (symbol . ^IXIC)
|
||||
# (gnc:time-no-zone . 2002-12-04 17:16:00)
|
||||
# (last . 1430.35)
|
||||
# (currency . failed-conversion)))
|
||||
|
||||
# On error, the overall result may be #f, or on individual errors, the
|
||||
# list sub-item for a given symbol may be #f, like this:
|
||||
|
||||
# $ echo '(yahoo "CSCO" "JDSU")' | ./price-quote-helper
|
||||
# $ echo '(yahoo "CSCO" "JDSU")' | ./finance-quote-helper
|
||||
# (#f
|
||||
# ("JDSU" (symbol . "JDSU")
|
||||
# (gnc:time-no-zone . "2001-03-13 19:27:00")
|
||||
@ -278,8 +282,9 @@ sub parse_input_line {
|
||||
|
||||
# Make sure we have an opening ( preceeded only by whitespace.
|
||||
# and followed by a one word method name composed of [a-z_]+.
|
||||
# Also allow the '.' and '^' characters for stock indices.
|
||||
# Kill off the whitespace if we do and grab the command.
|
||||
if($input !~ s/^\s*\(\s*([a-z_]+)\s+//o) { return 0; }
|
||||
if($input !~ s/^\s*\(\s*([\.\^a-z_]+)\s+//o) { return 0; }
|
||||
|
||||
my $quote_method_name = $1;
|
||||
|
||||
|
@ -274,21 +274,29 @@
|
||||
(define (get-quotes)
|
||||
(and quoter
|
||||
(let ((to-child (caddr quoter))
|
||||
(from-child (cadr quoter)))
|
||||
(from-child (cadr quoter))
|
||||
(results #f))
|
||||
(map
|
||||
(lambda (request)
|
||||
(write (list 'handling-request request))
|
||||
(newline)
|
||||
;; we need to display the first element (the method, so it
|
||||
;; won't be quoted) and then write the rest
|
||||
(display #\( to-child)
|
||||
(display (car request) to-child)
|
||||
(display " " to-child)
|
||||
(for-each (lambda (x) (write x to-child)) (cdr request))
|
||||
(display #\) to-child)
|
||||
(newline to-child)
|
||||
(force-output to-child)
|
||||
(read from-child))
|
||||
(catch
|
||||
#t
|
||||
(lambda ()
|
||||
(write (list 'handling-request request))
|
||||
(newline)
|
||||
;; we need to display the first element (the method, so it
|
||||
;; won't be quoted) and then write the rest
|
||||
(display #\( to-child)
|
||||
(display (car request) to-child)
|
||||
(display " " to-child)
|
||||
(for-each (lambda (x) (write x to-child)) (cdr request))
|
||||
(display #\) to-child)
|
||||
(newline to-child)
|
||||
(force-output to-child)
|
||||
(set! results (read from-child))
|
||||
;; (write (list 'results results)) (newline)
|
||||
results)
|
||||
(lambda (key . args)
|
||||
key)))
|
||||
requests))))
|
||||
|
||||
(define (kill-quoter)
|
||||
@ -597,7 +605,7 @@
|
||||
(map fq-call-data->fq-calls fq-call-data))))
|
||||
(fq-results (and fq-calls (gnc:fq-get-quotes fq-calls)))
|
||||
(commod-tz-quote-triples
|
||||
(and fq-results (not (member 'missing-lib fq-results))
|
||||
(and fq-results (list? (car fq-results))
|
||||
(fq-results->commod-tz-quote-triples fq-call-data fq-results)))
|
||||
;; At this point commod-tz-quote-triples will either be #f or a
|
||||
;; list of items. Each item will either be (commodity
|
||||
@ -627,6 +635,18 @@
|
||||
Run 'update-finance-quote' as root to install them."))
|
||||
(gnc:warn (_ "You are missing some needed Perl libraries.
|
||||
Run 'update-finance-quote' as root to install them.") "\n")))
|
||||
((member 'system-error fq-results)
|
||||
(set! keep-going? #f)
|
||||
(if (gnc:ui-is-running?)
|
||||
(gnc:error-dialog
|
||||
(_ "There was a system error while retrieving the price quotes."))
|
||||
(gnc:warn (_ "There was a system error while retrieving the price quotes.") "\n")))
|
||||
((not (list? (car fq-results)))
|
||||
(set! keep-going? #f)
|
||||
(if (gnc:ui-is-running?)
|
||||
(gnc:error-dialog
|
||||
(_ "There was an unknown error while retrieving the price quotes."))
|
||||
(gnc:warn (_ "There was an unknown error while retrieving the price quotes.") "\n")))
|
||||
((and (not commod-tz-quote-triples) (gnc:ui-is-running?))
|
||||
(gnc:error-dialog
|
||||
(_ "Unable to get quotes or diagnose the problem."))
|
||||
|
Loading…
Reference in New Issue
Block a user