insomnia/packages/insomnia-app/app/common/validate-insomnia-config.ts

24 lines
664 B
TypeScript
Raw Normal View History

import electron from 'electron';
import { omit } from 'ramda';
import { getConfigSettings } from '../models/helpers/settings';
import { exitApp } from './electron-helpers';
export const validateInsomniaConfig = () => {
const configSettings = getConfigSettings();
if ('error' in configSettings) {
const errors = configSettings.error.errors?.map(omit(['parentSchema', 'data']));
electron.dialog.showErrorBox('Invalid Insomnia Config',
[
`Invalid Insomnia Config found at "${configSettings.error.configPath}"`,
'',
'errors:',
`${JSON.stringify(errors, null, 2)}`,
].join('\n'),
);
exitApp();
}
};