From 8bae559da5cf426bb5dfd0a88942d47b7011fcae Mon Sep 17 00:00:00 2001 From: Manuel Luis SanmartĂ­n Rozada Date: Fri, 1 Aug 2014 00:26:22 +0200 Subject: jsrrdgraph: Fix error functions. Error prototype. --- js/Color.js | 2 +- js/RrdGraph.js | 7 ++++--- js/RrdRpn.js | 2 +- js/RrdTime.js | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/js/Color.js b/js/Color.js index e294f65..066e1a1 100644 --- a/js/Color.js +++ b/js/Color.js @@ -24,10 +24,10 @@ */ var ColorError = function (message) { - this.prototype = Error.prototype; this.name = "ColorError"; this.message = (message) ? message : "Error"; }; +ColorError.prototype = new Error(); /** * Color diff --git a/js/RrdGraph.js b/js/RrdGraph.js index 48b9814..a3b0124 100644 --- a/js/RrdGraph.js +++ b/js/RrdGraph.js @@ -27,10 +27,10 @@ */ var RrdGraphDescError = function (message) { - this.prototype = Error.prototype; this.name = "RrdGraphDescError"; this.message = (message) ? message : "Error"; }; +RrdGraphDescError.prototype = new Error(); /** * RrdGraphDesc @@ -393,10 +393,11 @@ RrdGraphDesc.prototype.hrule = function (graph, value, color, legend) */ var RrdVdefError = function (message) { - this.prototype = Error.prototype; this.name = "RrdVdefError"; this.message = (message) ? message : "Error"; }; +RrdVdefError.prototype = new Error(); + /** * RrdVdef @@ -694,10 +695,10 @@ RrdVdef.prototype.calc = function(src) */ var RrdGraphError = function (message) { - this.prototype = Error.prototype; this.name = "RrdGraphError"; this.message = (message) ? message : "Error"; }; +RrdGraphError.prototype = new Error(); /** * RrdGraph diff --git a/js/RrdRpn.js b/js/RrdRpn.js index 5ca8daf..3eb4e4a 100644 --- a/js/RrdRpn.js +++ b/js/RrdRpn.js @@ -27,10 +27,10 @@ */ var RrdRpnError = function (message) { - this.prototype = Error.prototype; this.name = "RrdRpnError"; this.message = (message) ? message : "RPN stack underflow"; }; +RrdRpnError.prototype = new Error(); /** * RrdRpn diff --git a/js/RrdTime.js b/js/RrdTime.js index c1de1fc..9010ece 100644 --- a/js/RrdTime.js +++ b/js/RrdTime.js @@ -27,10 +27,10 @@ */ var RrdTimeError = function (message) { - this.prototype = Error.prototype; this.name = "RrdTimeError"; this.message = (message) ? message : "Error"; }; +RrdTimeError.prototype = new Error(); /** * RrdTime -- cgit v1.1