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
+4 -5
View File
@@ -1,21 +1,20 @@
// parse the params from http call
import * as ERR from '../utilities/errortexts.js'
import {returnOnError} from "./reporterror.js"
const checkParams = (params, mo) => {
let o = {opts: {}, err: null}
if ((mo.mandatory.length !== 0) && (params === undefined)) {
return returnOnError(o, ERR.NOPARAMETER, checkParams.name )
return returnOnError(o, 'NOPARAMETER', checkParams.name )
}
for (let p of mo.mandatory) {
if (!(p.name in params)) {
return returnOnError(o, ERR.NOMANDPARAM.replace('xx', p.name), checkParams.name )
return returnOnError(o, 'NOMANDPARAM', checkParams.name, p.name)
}
if (p.type === 'int') {
let x = parseInt(params[p.name])
if (isNaN(x)) {
return returnOnError(o, ERR.PARAMNONUM, checkParams.name )
return returnOnError(o, 'PARAMNONUM', checkParams.name, p.name)
} else {
o.opts[p.name] = x
continue
@@ -23,7 +22,7 @@ const checkParams = (params, mo) => {
} else if (p.type === 'float') {
let x = parseFloat(params[p.name])
if (isNaN(x)) {
return returnOnError(o, ERR.PARAMNONUM, checkParams.name )
return returnOnError(o, 'PARAMNONUM', checkParams.name, p.name)
} else {
o.opts[p.name] = x
continue