From f476a55b0513e0e490edea38b58df42770aee835 Mon Sep 17 00:00:00 2001 From: Richard Wall Date: Sun, 14 Aug 2011 09:22:27 +0100 Subject: Throw an error in find_var when a given var name doesn't exist --- docs/examples/assets/js/jsrrdgraph.js | 26 +++++++++++++++----------- docs/examples/index.html | 6 +++--- 2 files changed, 18 insertions(+), 14 deletions(-) diff --git a/docs/examples/assets/js/jsrrdgraph.js b/docs/examples/assets/js/jsrrdgraph.js index 7dfdcad..d296ec6 100644 --- a/docs/examples/assets/js/jsrrdgraph.js +++ b/docs/examples/assets/js/jsrrdgraph.js @@ -4193,14 +4193,14 @@ RRDGraph.prototype = { find_var: function(key) { for (var ii = 0, gdes_c = this.gdes.length; ii < gdes_c; ii++) { - if ((this.gdes[ii].gf === RRDGraphDesc.GF.DEF || - this.gdes[ii].gf === RRDGraphDesc.GF.VDEF || - this.gdes[ii].gf === RRDGraphDesc.GF.CDEF) - && this.gdes[ii].vname === key) { - return ii; + if ((this.gdes[ii].gf === RRDGraphDesc.GF.DEF + || this.gdes[ii].gf === RRDGraphDesc.GF.VDEF + || this.gdes[ii].gf === RRDGraphDesc.GF.CDEF) + && this.gdes[ii].vname === key) { + return ii; + } } - } - return -1; + throw new Error('Key not found ' + key); }, // DEF:=::[:step=][:start=