[READ-ONLY] Mirror of https://github.com/FoxxMD/multi-scrobbler. Scrobble plays from multiple sources to multiple clients docs.multi-scrobbler.app
deezer docker jellyfin koito lastfm listenbrainz maloja mopidy mpris music music-assistant plex scrobble self-hosted spotify subsonic tautulli youtube-music
0

Configure Feed

Select the types of activity you want to include in your feed.

fix: Guard against ts-schema generation errors

* Check if generator is null and throw
* Check if schema is null before trying to validate, will make errors less cryptic

FoxxMD (Oct 11, 2024, 9:27 AM EDT) f7fa9cd3 ee8b3718

+8 -1
+5 -1
src/backend/utils/SchemaUtils.ts
··· 28 28 export const getTsConfigGenerator = (): TJS.JsonSchemaGenerator => { 29 29 if(generatorFromConfig === undefined) { 30 30 generatorFromConfig = buildSchemaGenerator(getTsConfigProgram()); 31 + if(generatorFromConfig === null) { 32 + throw new Error('Schema generator had errors! See console output.'); 33 + } 31 34 } 32 35 return generatorFromConfig; 33 36 } ··· 37 40 } 38 41 39 42 export const defaultGeneratorArgs: TJS.PartialArgs = { 40 - required: true, 43 + required: true, 44 + //ignoreErrors: true, 41 45 titles: true, 42 46 validationKeywords: ['deprecationMessage'], 43 47 constAsEnum: true,
+3
src/backend/utils/ValidationUtils.ts
··· 10 10 } 11 11 export const validateJson = <T>(config: object, schema: Schema, logger: Logger): T => { 12 12 const ajv = createAjvFactory(logger); 13 + if(schema === null) { 14 + throw new Error('Schema cannot be null'); 15 + } 13 16 const valid = ajv.validate(schema, config); 14 17 if (valid) { 15 18 return config as unknown as T;