diff --git a/package.json b/package.json index cac51ff..18c6a2c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "maniiifest", - "version": "1.2.1", + "version": "1.2.2", "main": "dist/index.js", "types": "dist/index.d.ts", "files": [ diff --git a/src/Maniiifest.ts b/src/Maniiifest.ts index 82f0c60..f941de9 100644 --- a/src/Maniiifest.ts +++ b/src/Maniiifest.ts @@ -30,25 +30,21 @@ export class Maniiifest { * @throws {Error} Throws an error if an unsupported type is provided. */ constructor(data: any, type?: string) { - try { - switch (type) { - case "AnnotationCollection": - this.specification = F.readAnnotationCollectionT(data); - break; - case "AnnotationPage": - this.specification = F.readAnnotationPageT(data); - break; - case "Annotation": - this.specification = F.readAnnotationT(data); - break; - case undefined: - this.specification = F.readSpecificationT(data); - break; - default: - throw new Error(`Unsupported type: ${type}`); - } - } catch (error) { - console.error("Failed to read specification:", error); + switch (type) { + case "AnnotationCollection": + this.specification = F.readAnnotationCollectionT(data); + break; + case "AnnotationPage": + this.specification = F.readAnnotationPageT(data); + break; + case "Annotation": + this.specification = F.readAnnotationT(data); + break; + case undefined: + this.specification = F.readSpecificationT(data); + break; + default: + throw new Error(`Unsupported type: ${type}`); } }