Commit 3c7ade5d authored by Johannes Bill's avatar Johannes Bill

fixed error propagaytion

parent b79718bf
{
"restApiHost": "127.0.0.1",
"restApiPort": 3001,
"mysqlConfig": {
"host": "127.0.0.1",
"port": 3306,
"database": "gemeindeschluessel",
"username": "root",
"password": "bla"
}
}
\ No newline at end of file
var mysql = require('mysql');
var http = require('http');
var config = require('../config.json');
var hostname = "127.0.0.1";
var port = 3001;
var headers = {
"Content-Type": "application/json",
"Connection": "keep-alive"
};
var hostname = config["restApiHost"];
var port = config["restApiPort"];
var blndMapping = {
"Baden-Württemberg": "BW",
......@@ -26,6 +23,10 @@ var blndMapping = {
"Thüringen": "TH"
};
var headers = {
"Content-Type": "application/json",
"Connection": "keep-alive"
};
function request(path, cb) {
var options = {
hostname: hostname,
......@@ -47,6 +48,7 @@ function request(path, cb) {
var req = http.request(options, callback);
req.on("error", function (err) {
err = new Error('Could not connect to: ' + hostname + path );
cb(err);
});
req.setTimeout(500, function () {
......@@ -88,7 +90,7 @@ module.exports.getKatholisch = function(plz, cb) {
return cb(err);
}
if (feiertag === undefined)
return cb(new Error("no religion entry found for plz " + plz));
return cb(new Error("no entry found in religion table for plz " + plz));
cb(null, !!feiertag);
})
};
......
......@@ -91,7 +91,8 @@ function wrapper(_epochSpan) {
}
function getDaySpan(data) {
var dayoption = parseInt(data["dayoption"]["0"]);
var dayoptionS = data["dayoption"]["0"];
var dayoption = parseInt(dayoptionS);
if (dayoption < 7) return [dayoption, dayoption];
switch (dayoption) {
case 7:
......@@ -103,7 +104,7 @@ function wrapper(_epochSpan) {
case 10:
return [1, 6];
default:
throw new Error("Invalid day option: " + dayoption);
throw new Error("Invalid day option: " + dayoptionS);
}
}
......
var holidayMapping = require('./holidayMapping.json');
var easterSunday = require('./easterSunday');
var restRequest = require('./restRequests');
var restRequest = require('./blndRelRequest');
var SimplQueue = require('./simplQueue');
var easterSundays = {};
......
Markdown is supported
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