summaryrefslogtreecommitdiff
path: root/jarmon/jarmon.js
diff options
context:
space:
mode:
authorRichard Wall <richard@largo>2010-09-02 23:52:25 +0100
committerRichard Wall <richard@largo>2010-09-02 23:52:25 +0100
commitddfdbf0e40aa2a9ac7f48520829dc6b30ff3c02b (patch)
tree7dd6d9ab6a3f9e7678543233637c0f0ddf302b2a /jarmon/jarmon.js
parentd3925d12f03b48581ebc4464d9ed82e32acea865 (diff)
Add test for unknown consolidation function error
Diffstat (limited to 'jarmon/jarmon.js')
-rw-r--r--jarmon/jarmon.js19
1 files changed, 3 insertions, 16 deletions
diff --git a/jarmon/jarmon.js b/jarmon/jarmon.js
index 32e0283..3f63b3e 100644
--- a/jarmon/jarmon.js
+++ b/jarmon/jarmon.js
@@ -127,20 +127,6 @@ jarmon.localTimeFormatter = function (v, axis) {
};
-jarmon.TimeRangeError = function(message) {
- /**
- * Raised when an invalid timerange is encountered.
- *
- * @class jarmon.TimeRangeError
- * @constructor
- * @param message {String} A description of the error reason
- **/
- this.name = "TimeRangeError";
- this.message = (message || "");
-}
-jarmon.TimeRangeError.prototype = Error.prototype;
-
-
/**
* A wrapper around an instance of javascriptrrd.RRDFile which provides a
* convenient way to query the RRDFile based on time range, RRD data source (DS)
@@ -173,7 +159,7 @@ jarmon.RrdQuery.prototype.getData = function(startTimeJs, endTimeJs, dsId, cfNam
**/
if (startTimeJs >= endTimeJs) {
- throw new jarmon.TimeRangeError(
+ throw RangeError(
['starttime must be less than endtime. ',
'starttime: ', startTimeJs,
'endtime: ', endTimeJs].join(''));
@@ -182,6 +168,7 @@ jarmon.RrdQuery.prototype.getData = function(startTimeJs, endTimeJs, dsId, cfNam
// The startTime, endTime and lastupdate time are not necessarily on a step
// boundaries. Here we divide, round and then multiply by the step size to
// find the nearest "Primary Data Point" (PDP) time.
+ console.log('RRD: ', this.rrd);
var minStep = this.rrd.getMinStep();
var startTime = Math.round(startTimeJs/1000/minStep) * minStep;
var lastUpdated = this.rrd.getLastUpdate();
@@ -229,7 +216,7 @@ jarmon.RrdQuery.prototype.getData = function(startTimeJs, endTimeJs, dsId, cfNam
// If we got to the end of the loop without ever defining step, it means
// that the CF check never succeded.
if(!step) {
- throw new Error('Unrecognised consolidation function: ' + cfName);
+ throw TypeError('Unrecognised consolidation function: ' + cfName);
}
var startRowTime = Math.floor(startTime/step)*step + step;