Merge pull request #979 from matkoniecz/feature/log-more-clear-errors

provide more clear errors
This commit is contained in:
Mike Simpson 2022-11-23 09:09:27 +00:00 committed by GitHub
commit 5c541b5ca0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,16 +38,16 @@ router.get('/:tileset/:z/:x/:y(\\d+):scale(@\\dx)?.png', handleTileRequest);
function parseTileParams(params: any): TileParams {
const { tileset, z, x, y, scale } = params;
if (!allTilesets.includes(tileset)) throw new Error('Invalid value for tileset');
if (!allTilesets.includes(tileset)) throw new Error('Invalid value for tileset: ' + tileset);
const intZ = strictParseInt(z);
if (isNaN(intZ)) throw new Error('Invalid value for z');
if (isNaN(intZ)) throw new Error('Invalid value for z: ' + intZ);
const intX = strictParseInt(x);
if (isNaN(intX)) throw new Error('Invalid value for x');
if (isNaN(intX)) throw new Error('Invalid value for x: ' + intX);
const intY = strictParseInt(y);
if (isNaN(intY)) throw new Error('Invalid value for y');
if (isNaN(intY)) throw new Error('Invalid value for y: ' + intY);
let intScale: number;
if (scale === '@2x') {