All error messages in german and in englisch

This commit is contained in:
rxf
2023-05-09 15:37:27 +02:00
parent 2cf418756d
commit 347c6bdc96
17 changed files with 1007 additions and 243 deletions
+3 -7
View File
@@ -1,12 +1,8 @@
// Fetch the actual (= newest) data out of the dbase to show it on the map
import {DateTime} from "luxon"
import {logit} from "../utilities/logit.js"
import * as mongo from "../databases/mongo.js"
import {reportError, returnOnError} from "../utilities/reporterror.js"
import * as ERR from "../utilities/errortexts.js"
import checkParams from "../utilities/checkparams.js";
import {fetchFromInflux} from "./getsensorData.js";
import {NOPROPSFOUND} from "../utilities/errortexts.js";
import { returnOnError } from "../utilities/reporterror.js"
import { fetchFromInflux } from "./getsensorData.js";
// Default distance for center search ( in km)
@@ -136,7 +132,7 @@ export var getData4map = async (params) => {
// fetch mapdata from mongodb
let { properties, err } = await mongo.getallProperties(mongo.properties_collection, query)
if(err) {
return returnOnError(ret, ERR.NOPROPSFOUND, getData4map.name)
return returnOnError(ret, 'NOPROPSFOUND', getData4map.name)
}
let v4map = getValue4Map(typ)
for (let sensor of properties) {
+1 -1
View File
@@ -16,7 +16,7 @@ export const getAddress = async (params) => {
try {
const response = await axios(encodeURI(url));
if (response.status !== 200) {
return returnOnError(ret, ERR.RESPSTATUS.replace('ss', response.status, getAddress.name))
return returnOnError(ret, 'RESPSTATUS', getAddress.name, response.status)
}
let akt = response.data.address
logit(JSON.stringify(akt))
+2 -3
View File
@@ -3,7 +3,6 @@
import * as mongo from "../databases/mongo.js"
import * as mock from "../mocks/mongo_mock.js"
import {returnOnError} from "../utilities/reporterror.js"
import * as ERR from "../utilities/errortexts.js"
import checkParams from "../utilities/checkparams.js"
const mockdb = false
@@ -26,13 +25,13 @@ export const getOneProperty = async (params) => {
try {
let pp = await readProperties({sid: opts.sensorid}); // read for given sensorID
if ((pp.properties == null) || (pp.error)) {
return returnOnError(properties, ERR.NOPROPSREAD.replace('xx', opts.sensorid), getOneProperty.name)
return returnOnError(properties, 'NOPROPSREAD', getOneProperty.name, opts.sensorid)
}
// now find sensors with same location
let query = {"location.0.id": pp.properties.location[0].id}
let others = await readProperties(query)
if (others.err) {
return returnOnError(properties, ERR.NOPROPSREAD.replace('xx',others.errortext), getOneProperty.name)
return returnOnError(properties, 'NOPROPSREAD', getOneProperty.name, others.errortext)
}
if (others.properties.length > 0) {
for (const x of others.properties) {
+3 -4
View File
@@ -6,7 +6,6 @@ import * as mongo from "../databases/mongo.js"
import {returnOnError} from "../utilities/reporterror.js"
import {csv2Json} from "../utilities/csv2json.js"
import checkParams from "../utilities/checkparams.js"
import * as ERR from "../utilities/errortexts.js"
import {getOneProperty} from "./getproperties.js"
import {getNoiseData} from "../sensorspecials/noise.js"
import {getRadioData} from "../sensorspecials/radioact.js"
@@ -127,7 +126,7 @@ export async function getSensorData(params) {
return ret
}
}
return returnOnError(ret, ERR.CMNDUNKOWN, getActData.name)
return returnOnError(ret, 'CMNDUNKNOWN', getActData.name)
}
@@ -236,13 +235,13 @@ export const fetchFromInflux = async (ret, query) => {
let { values, err} = await influx.influxRead(query)
if(err) {
if(err.toString().includes('400')) {
return returnOnError(ret, ERR.SYNTAXURL, fetchFromInflux.name)
return returnOnError(ret, 'SYNTAXURL', fetchFromInflux.name)
} else {
return returnOnError(ret, err, fetchFromInflux.name)
}
}
if (values.length <= 2) {
return returnOnError(ret, ERR.NODATA, fetchFromInflux.name)
return returnOnError(ret, 'NODATA', fetchFromInflux.name)
}
ret.values = csv2Json(values)
return ret