diff --git a/packages/lib/models/Setting.ts b/packages/lib/models/Setting.ts index 173f3d0d6e..c18b3396da 100644 --- a/packages/lib/models/Setting.ts +++ b/packages/lib/models/Setting.ts @@ -9,6 +9,7 @@ import FileHandler, { SettingValues } from './settings/FileHandler'; import Logger from '../Logger'; import mergeGlobalAndLocalSettings from '../services/profileConfig/mergeGlobalAndLocalSettings'; import splitGlobalAndLocalSettings from '../services/profileConfig/splitGlobalAndLocalSettings'; +import JoplinError from '../JoplinError'; const { sprintf } = require('sprintf-js'); const ObjectUtils = require('../ObjectUtils'); const { toTitleCase } = require('../string-utils.js'); @@ -1810,7 +1811,7 @@ class Setting extends BaseModel { public static settingMetadata(key: string): SettingItem { const metadata = this.metadata(); - if (!(key in metadata)) throw new Error(`Unknown key: ${key}`); + if (!(key in metadata)) throw new JoplinError(`Unknown key: ${key}`, 'unknown_key'); const output = Object.assign({}, metadata[key]); output.key = key; return output; diff --git a/packages/lib/services/profileConfig/mergeGlobalAndLocalSettings.ts b/packages/lib/services/profileConfig/mergeGlobalAndLocalSettings.ts index e5dfacf4c6..f296eed8ae 100644 --- a/packages/lib/services/profileConfig/mergeGlobalAndLocalSettings.ts +++ b/packages/lib/services/profileConfig/mergeGlobalAndLocalSettings.ts @@ -1,5 +1,8 @@ +import Logger from '../../Logger'; import Setting from '../../models/Setting'; +const logger = Logger.create('mergeGlobalAndLocalSettings'); + export default (rootSettings: Record, subProfileSettings: Record) => { const output: Record = { ...subProfileSettings }; @@ -12,9 +15,20 @@ export default (rootSettings: Record, subProfileSettings: Record