Add error codes for IIIF errors

60: "Missing or invalid `size`."
Without at least a size, no IIIF can be displayed.

61: "Cannot determine IIIF Image API version from provided image
information JSON."
Without finding out the version information, one could only guess how to
use the image info JSON.
This commit is contained in:
Lutz Helm
2019-03-15 16:02:29 +01:00
committed by Lutz Helm
parent 58efe1f850
commit 0ab7ad741f
3 changed files with 11 additions and 7 deletions
+1 -2
View File
@@ -54,9 +54,8 @@ class IIIF extends TileImage {
const version = options.version || Versions.VERSION2;
const sizes = options.sizes || [];
const size = options.size;
// TODO Appropriate error code
assert(size != undefined && Array.isArray(size) && size.length == 2 &&
!isNaN(size[0]) && size[0] > 0 && !isNaN(size[1] && size[1] > 0), 999);
!isNaN(size[0]) && size[0] > 0 && !isNaN(size[1] && size[1] > 0), 60);
const width = size[0];
const height = size[1];
const tileSize = options.tileSize;