Verified Commit 2e96670d authored by Stefan Brunecker's avatar Stefan Brunecker
Browse files

Output port name in error messages in js wrapper

parent 2982a96e
......@@ -26,13 +26,13 @@ function setInNoRangeNoUnit(_inNoRangeNoUnit) {
var value = math.eval(_inNoRangeNoUnit);
if (value === undefined) {
throw "Could not evaluate input for _inNoRangeNoUnit";
throw "inNoRangeNoUnit: Could not evaluate input";
}
//check dimension
var dim = math.matrix([4]);
if (!math.deepEqual(value.size(), dim)) {
throw "Input has dimension " + value.size() + " but expected " + dim;
throw "inNoRangeNoUnit: Input has dimension " + value.size() + " but expected " + dim;
}
var array = [];
......
......@@ -28,13 +28,13 @@ function setInRangeNoUnit(_inRangeNoUnit) {
var upper = 10 / 1;
if (value === undefined) {
throw "Could not evaluate input for _inRangeNoUnit";
throw "inRangeNoUnit: Could not evaluate input";
}
//check dimension
var dim = math.matrix([4]);
if (!math.deepEqual(value.size(), dim)) {
throw "Input has dimension " + value.size() + " but expected " + dim;
throw "inRangeNoUnit: Input has dimension " + value.size() + " but expected " + dim;
}
var array = [];
......@@ -44,10 +44,10 @@ function setInRangeNoUnit(_inRangeNoUnit) {
var e_num = e;
//check range
if (math.smaller(e_num, lower)) {
throw "Value " + e_num + " out of range";
throw "inRangeNoUnit: Value " + e_num + " out of range";
}
if (math.larger(e_num, upper)) {
throw "Value " + e_num + " out of range";
throw "inRangeNoUnit: Value " + e_num + " out of range";
}
array[i0] = e_num;
}
......
......@@ -28,13 +28,13 @@ function setInRangeUnit(_inRangeUnit) {
var upper = math.eval("10/1 km/h").toSI().toNumber();
if (value === undefined) {
throw "Could not evaluate input for _inRangeUnit";
throw "inRangeUnit: Could not evaluate input";
}
//check dimension
var dim = math.matrix([4]);
if (!math.deepEqual(value.size(), dim)) {
throw "Input has dimension " + value.size() + " but expected " + dim;
throw "inRangeUnit: Input has dimension " + value.size() + " but expected " + dim;
}
var array = [];
......@@ -44,15 +44,15 @@ function setInRangeUnit(_inRangeUnit) {
//check unit
var expectedUnit = math.eval("m/s");
if (math.typeof(expectedUnit) !== math.typeof(e) || !expectedUnit.equalBase(e)) {
throw "Expected unit m/s";
throw "inRangeUnit: Expected unit m/s";
}
var e_num = e.toSI().toNumber();
//check range
if (math.smaller(e_num, lower)) {
throw "Value " + e_num + " out of range";
throw "inRangeUnit: Value " + e_num + " out of range";
}
if (math.larger(e_num, upper)) {
throw "Value " + e_num + " out of range";
throw "inRangeUnit: Value " + e_num + " out of range";
}
array[i0] = e_num;
}
......
......@@ -27,18 +27,18 @@ function setPower(_power) {
var lower = math.eval("0/1 kg*m^2/s^3").toSI().toNumber();
if (value === undefined) {
throw "Could not evaluate input for _power";
throw "power: Could not evaluate input";
}
//check unit
var expectedUnit = math.eval("kg*m^2/s^3");
if (math.typeof(expectedUnit) !== math.typeof(value) || !expectedUnit.equalBase(value)) {
throw "Expected unit kg*m^2/s^3";
throw "power: Expected unit kg*m^2/s^3";
}
var value_num = value.toSI().toNumber();
//check range
if (math.smaller(value_num, lower)) {
throw "Value " + value_num + " out of range";
throw "power: Value " + value_num + " out of range";
}
Module.setPower(value_num);
}
......@@ -26,13 +26,13 @@ function setInNoRangeNoUnit(_inNoRangeNoUnit) {
var value = math.eval(_inNoRangeNoUnit);
if (value === undefined) {
throw "Could not evaluate input for _inNoRangeNoUnit";
throw "inNoRangeNoUnit: Could not evaluate input";
}
//check dimension
var dim = math.matrix([3, 1]);
if (!math.deepEqual(value.size(), dim)) {
throw "Input has dimension " + value.size() + " but expected " + dim;
throw "inNoRangeNoUnit: Input has dimension " + value.size() + " but expected " + dim;
}
var array = [];
......
......@@ -28,13 +28,13 @@ function setInRangeNoUnit(_inRangeNoUnit) {
var upper = 10 / 1;
if (value === undefined) {
throw "Could not evaluate input for _inRangeNoUnit";
throw "inRangeNoUnit: Could not evaluate input";
}
//check dimension
var dim = math.matrix([3, 1]);
if (!math.deepEqual(value.size(), dim)) {
throw "Input has dimension " + value.size() + " but expected " + dim;
throw "inRangeNoUnit: Input has dimension " + value.size() + " but expected " + dim;
}
var array = [];
......@@ -46,10 +46,10 @@ function setInRangeNoUnit(_inRangeNoUnit) {
var e_num = e;
//check range
if (math.smaller(e_num, lower)) {
throw "Value " + e_num + " out of range";
throw "inRangeNoUnit: Value " + e_num + " out of range";
}
if (math.larger(e_num, upper)) {
throw "Value " + e_num + " out of range";
throw "inRangeNoUnit: Value " + e_num + " out of range";
}
array[i0][i1] = e_num;
}
......
......@@ -29,13 +29,13 @@ function setInRangeUnit(_inRangeUnit) {
var upper = math.eval("10/1 km/h").toSI().toNumber();
if (value === undefined) {
throw "Could not evaluate input for _inRangeUnit";
throw "inRangeUnit: Could not evaluate input";
}
//check dimension
var dim = math.matrix([3, 1]);
if (!math.deepEqual(value.size(), dim)) {
throw "Input has dimension " + value.size() + " but expected " + dim;
throw "inRangeUnit: Input has dimension " + value.size() + " but expected " + dim;
}
var array = [];
......@@ -47,15 +47,15 @@ function setInRangeUnit(_inRangeUnit) {
//check unit
var expectedUnit = math.eval("m/s");
if (math.typeof(expectedUnit) !== math.typeof(e) || !expectedUnit.equalBase(e)) {
throw "Expected unit m/s";
throw "inRangeUnit: Expected unit m/s";
}
var e_num = e.toSI().toNumber();
//check range
if (math.smaller(e_num, lower)) {
throw "Value " + e_num + " out of range";
throw "inRangeUnit: Value " + e_num + " out of range";
}
if (math.larger(e_num, upper)) {
throw "Value " + e_num + " out of range";
throw "inRangeUnit: Value " + e_num + " out of range";
}
array[i0][i1] = e_num;
}
......
......@@ -26,13 +26,13 @@ function setInNoRangeNoUnit(_inNoRangeNoUnit) {
var value = math.eval(_inNoRangeNoUnit);
if (value === undefined) {
throw "Could not evaluate input for _inNoRangeNoUnit";
throw "inNoRangeNoUnit: Could not evaluate input";
}
//check dimension
var dim = math.matrix([4, 2, 3]);
if (!math.deepEqual(value.size(), dim)) {
throw "Input has dimension " + value.size() + " but expected " + dim;
throw "inNoRangeNoUnit: Input has dimension " + value.size() + " but expected " + dim;
}
var array = [];
......
......@@ -28,13 +28,13 @@ function setInRangeNoUnit(_inRangeNoUnit) {
var upper = 10 / 1;
if (value === undefined) {
throw "Could not evaluate input for _inRangeNoUnit";
throw "inRangeNoUnit: Could not evaluate input";
}
//check dimension
var dim = math.matrix([4, 2, 3]);
if (!math.deepEqual(value.size(), dim)) {
throw "Input has dimension " + value.size() + " but expected " + dim;
throw "inRangeNoUnit: Input has dimension " + value.size() + " but expected " + dim;
}
var array = [];
......@@ -49,10 +49,10 @@ function setInRangeNoUnit(_inRangeNoUnit) {
var e_num = e;
//check range
if (math.smaller(e_num, lower)) {
throw "Value " + e_num + " out of range";
throw "inRangeNoUnit: Value " + e_num + " out of range";
}
if (math.larger(e_num, upper)) {
throw "Value " + e_num + " out of range";
throw "inRangeNoUnit: Value " + e_num + " out of range";
}
array[i0][i1][i2] = e_num;
}
......
......@@ -28,13 +28,13 @@ function setInRangeUnit(_inRangeUnit) {
var upper = math.eval("10/1 km/h").toSI().toNumber();
if (value === undefined) {
throw "Could not evaluate input for _inRangeUnit";
throw "inRangeUnit: Could not evaluate input";
}
//check dimension
var dim = math.matrix([4, 2, 3]);
if (!math.deepEqual(value.size(), dim)) {
throw "Input has dimension " + value.size() + " but expected " + dim;
throw "inRangeUnit: Input has dimension " + value.size() + " but expected " + dim;
}
var array = [];
......@@ -49,15 +49,15 @@ function setInRangeUnit(_inRangeUnit) {
//check unit
var expectedUnit = math.eval("m/s");
if (math.typeof(expectedUnit) !== math.typeof(e) || !expectedUnit.equalBase(e)) {
throw "Expected unit m/s";
throw "inRangeUnit: Expected unit m/s";
}
var e_num = e.toSI().toNumber();
//check range
if (math.smaller(e_num, lower)) {
throw "Value " + e_num + " out of range";
throw "inRangeUnit: Value " + e_num + " out of range";
}
if (math.larger(e_num, upper)) {
throw "Value " + e_num + " out of range";
throw "inRangeUnit: Value " + e_num + " out of range";
}
array[i0][i1][i2] = e_num;
}
......
......@@ -26,13 +26,13 @@ function setInNoRangeNoUnit(_inNoRangeNoUnit) {
var value = math.eval(_inNoRangeNoUnit);
if (value === undefined) {
throw "Could not evaluate input for _inNoRangeNoUnit";
throw "inNoRangeNoUnit: Could not evaluate input";
}
//check dimension
var dim = math.matrix([2, 3]);
if (!math.deepEqual(value.size(), dim)) {
throw "Input has dimension " + value.size() + " but expected " + dim;
throw "inNoRangeNoUnit: Input has dimension " + value.size() + " but expected " + dim;
}
var array = [];
......
......@@ -28,13 +28,13 @@ function setInRangeNoUnit(_inRangeNoUnit) {
var upper = 10 / 1;
if (value === undefined) {
throw "Could not evaluate input for _inRangeNoUnit";
throw "inRangeNoUnit: Could not evaluate input";
}
//check dimension
var dim = math.matrix([2, 3]);
if (!math.deepEqual(value.size(), dim)) {
throw "Input has dimension " + value.size() + " but expected " + dim;
throw "inRangeNoUnit: Input has dimension " + value.size() + " but expected " + dim;
}
var array = [];
......@@ -46,10 +46,10 @@ function setInRangeNoUnit(_inRangeNoUnit) {
var e_num = e;
//check range
if (math.smaller(e_num, lower)) {
throw "Value " + e_num + " out of range";
throw "inRangeNoUnit: Value " + e_num + " out of range";
}
if (math.larger(e_num, upper)) {
throw "Value " + e_num + " out of range";
throw "inRangeNoUnit: Value " + e_num + " out of range";
}
array[i0][i1] = e_num;
}
......
......@@ -28,13 +28,13 @@ function setInRangeUnit(_inRangeUnit) {
var upper = math.eval("10/1 km/h").toSI().toNumber();
if (value === undefined) {
throw "Could not evaluate input for _inRangeUnit";
throw "inRangeUnit: Could not evaluate input";
}
//check dimension
var dim = math.matrix([2, 3]);
if (!math.deepEqual(value.size(), dim)) {
throw "Input has dimension " + value.size() + " but expected " + dim;
throw "inRangeUnit: Input has dimension " + value.size() + " but expected " + dim;
}
var array = [];
......@@ -46,15 +46,15 @@ function setInRangeUnit(_inRangeUnit) {
//check unit
var expectedUnit = math.eval("m/s");
if (math.typeof(expectedUnit) !== math.typeof(e) || !expectedUnit.equalBase(e)) {
throw "Expected unit m/s";
throw "inRangeUnit: Expected unit m/s";
}
var e_num = e.toSI().toNumber();
//check range
if (math.smaller(e_num, lower)) {
throw "Value " + e_num + " out of range";
throw "inRangeUnit: Value " + e_num + " out of range";
}
if (math.larger(e_num, upper)) {
throw "Value " + e_num + " out of range";
throw "inRangeUnit: Value " + e_num + " out of range";
}
array[i0][i1] = e_num;
}
......
......@@ -26,13 +26,13 @@ function setInNoRangeNoUnit(_inNoRangeNoUnit) {
var value = math.eval(_inNoRangeNoUnit);
if (value === undefined) {
throw "Could not evaluate input for _inNoRangeNoUnit";
throw "inNoRangeNoUnit: Could not evaluate input";
}
//check dimension
var dim = math.matrix([1, 3]);
if (!math.deepEqual(value.size(), dim)) {
throw "Input has dimension " + value.size() + " but expected " + dim;
throw "inNoRangeNoUnit: Input has dimension " + value.size() + " but expected " + dim;
}
var array = [];
......
......@@ -28,13 +28,13 @@ function setInRangeNoUnit(_inRangeNoUnit) {
var upper = 10 / 1;
if (value === undefined) {
throw "Could not evaluate input for _inRangeNoUnit";
throw "inRangeNoUnit: Could not evaluate input";
}
//check dimension
var dim = math.matrix([1, 3]);
if (!math.deepEqual(value.size(), dim)) {
throw "Input has dimension " + value.size() + " but expected " + dim;
throw "inRangeNoUnit: Input has dimension " + value.size() + " but expected " + dim;
}
var array = [];
......@@ -46,10 +46,10 @@ function setInRangeNoUnit(_inRangeNoUnit) {
var e_num = e;
//check range
if (math.smaller(e_num, lower)) {
throw "Value " + e_num + " out of range";
throw "inRangeNoUnit: Value " + e_num + " out of range";
}
if (math.larger(e_num, upper)) {
throw "Value " + e_num + " out of range";
throw "inRangeNoUnit: Value " + e_num + " out of range";
}
array[i0][i1] = e_num;
}
......
......@@ -28,13 +28,13 @@ function setInRangeUnit(_inRangeUnit) {
var upper = math.eval("10/1 km/h").toSI().toNumber();
if (value === undefined) {
throw "Could not evaluate input for _inRangeUnit";
throw "inRangeUnit: Could not evaluate input";
}
//check dimension
var dim = math.matrix([1, 3]);
if (!math.deepEqual(value.size(), dim)) {
throw "Input has dimension " + value.size() + " but expected " + dim;
throw "inRangeUnit: Input has dimension " + value.size() + " but expected " + dim;
}
var array = [];
......@@ -47,15 +47,15 @@ function setInRangeUnit(_inRangeUnit) {
//check unit
var expectedUnit = math.eval("m/s");
if (math.typeof(expectedUnit) !== math.typeof(e) || !expectedUnit.equalBase(e)) {
throw "Expected unit m/s";
throw "inRangeUnit: Expected unit m/s";
}
var e_num = e.toSI().toNumber();
//check range
if (math.smaller(e_num, lower)) {
throw "Value " + e_num + " out of range";
throw "inRangeUnit: Value " + e_num + " out of range";
}
if (math.larger(e_num, upper)) {
throw "Value " + e_num + " out of range";
throw "inRangeUnit: Value " + e_num + " out of range";
}
array[i0][i1] = e_num;
}
......
......@@ -26,7 +26,7 @@ function setInNoRangeNoUnit(_inNoRangeNoUnit) {
var value = math.eval(_inNoRangeNoUnit);
if (value === undefined) {
throw "Could not evaluate input for _inNoRangeNoUnit";
throw "inNoRangeNoUnit: Could not evaluate input";
}
var value_num = value;
......
......@@ -28,16 +28,16 @@ function setInRangeNoUnit(_inRangeNoUnit) {
var upper = 10 / 1;
if (value === undefined) {
throw "Could not evaluate input for _inRangeNoUnit";
throw "inRangeNoUnit: Could not evaluate input";
}
var value_num = value;
//check range
if (math.smaller(value_num, lower)) {
throw "Value " + value_num + " out of range";
throw "inRangeNoUnit: Value " + value_num + " out of range";
}
if (math.larger(value_num, upper)) {
throw "Value " + value_num + " out of range";
throw "inRangeNoUnit: Value " + value_num + " out of range";
}
Module.setInRangeNoUnit(value_num);
}
......@@ -28,21 +28,21 @@ function setInRangeUnit(_inRangeUnit) {
var upper = math.eval("10/1 km/h").toSI().toNumber();
if (value === undefined) {
throw "Could not evaluate input for _inRangeUnit";
throw "inRangeUnit: Could not evaluate input";
}
//check unit
var expectedUnit = math.eval("m/s");
if (math.typeof(expectedUnit) !== math.typeof(value) || !expectedUnit.equalBase(value)) {
throw "Expected unit m/s";
throw "inRangeUnit: Expected unit m/s";
}
var value_num = value.toSI().toNumber();
//check range
if (math.smaller(value_num, lower)) {
throw "Value " + value_num + " out of range";
throw "inRangeUnit: Value " + value_num + " out of range";
}
if (math.larger(value_num, upper)) {
throw "Value " + value_num + " out of range";
throw "inRangeUnit: Value " + value_num + " out of range";
}
Module.setInRangeUnit(value_num);
}
......@@ -27,13 +27,13 @@ function setInThousandsMatrixArray(_inThousandsMatrixArray) {
var lower = math.eval("2/1 m").toSI().toNumber();
if (value === undefined) {
throw "Could not evaluate input for _inThousandsMatrixArray";
throw "inThousandsMatrixArray: Could not evaluate input";
}
//check dimension
var dim = math.matrix([1111, 1234, 3, 1200300]);
if (!math.deepEqual(value.size(), dim)) {
throw "Input has dimension " + value.size() + " but expected " + dim;
throw "inThousandsMatrixArray: Input has dimension " + value.size() + " but expected " + dim;
}
var array = [];
......@@ -49,12 +49,12 @@ function setInThousandsMatrixArray(_inThousandsMatrixArray) {
//check unit
var expectedUnit = math.eval("m");
if (math.typeof(expectedUnit) !== math.typeof(e) || !expectedUnit.equalBase(e)) {
throw "Expected unit m";
throw "inThousandsMatrixArray: Expected unit m";
}
var e_num = e.toSI().toNumber();
//check range
if (math.smaller(e_num, lower)) {
throw "Value " + e_num + " out of range";
throw "inThousandsMatrixArray: Value " + e_num + " out of range";
}
array[i0][i1][i2][i3] = e_num;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment