refactor(core): Switch plain errors in cli to ApplicationError (#7857)
Ensure all errors in `cli` are `ApplicationError` or children of it and contain no variables in the message, to continue normalizing all the errors we report to Sentry Follow-up to: https://github.com/n8n-io/n8n/pull/7839
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
import { NotStringArrayError } from '@/errors/not-string-array.error';
|
||||
import type { SchemaObj } from 'convict';
|
||||
import { ApplicationError } from 'n8n-workflow';
|
||||
|
||||
export const ensureStringArray = (values: string[], { env }: SchemaObj<string>) => {
|
||||
if (!env) throw new Error(`Missing env: ${env}`);
|
||||
if (!env) throw new ApplicationError('Missing env', { extra: { env } });
|
||||
|
||||
if (!Array.isArray(values)) throw new NotStringArrayError(env);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user