trompamusic/ce-api

json-ld: Raise custom error if json file for output configuration is missing

Closed this issue · 0 comments

We have a test to try and load a config from a mapping file:

const config = require(`./jsonld/${type}.json`)
if (!config) {
throw new Error(`JSON LD not supported for type "${type}"`)
}

however the require will fail with an exception if the file is missing and we don't get our custom "JSON LD not supported for type" error message