Add better error message to parseIntParam
This commit is contained in:
parent
9734c089fa
commit
fd78724203
@ -1,9 +1,10 @@
|
||||
import { strictParseInt } from '../parse';
|
||||
|
||||
export function parseIntParam(param: string) {
|
||||
export function parseIntParam(param: string, paramName?: string) {
|
||||
const result = strictParseInt(param);
|
||||
if (isNaN(result)) {
|
||||
throw new Error('Invalid parameter format: not an integer');
|
||||
const paramNameString = paramName == undefined ? '' : paramName + ' ';
|
||||
throw new Error(`Invalid parameter ${paramNameString}format: not an integer`);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user