diff --git a/packages/nocodb/src/helpers/catchError.ts b/packages/nocodb/src/helpers/catchError.ts index 7fc305ec87..1cf89641b6 100644 --- a/packages/nocodb/src/helpers/catchError.ts +++ b/packages/nocodb/src/helpers/catchError.ts @@ -636,7 +636,14 @@ const errorHelpers: { code: 400, }, [NcErrorType.FORMULA_ERROR]: { - message: (message: string) => `Formula error: ${message}`, + message: (message: string) => { + // try to extract db error - Experimental + if (message.includes(' - ')) { + const [_, dbError] = message.split(' - '); + return `Formula error: ${dbError}`; + } + return `Formula error: ${message}`; + }, code: 400, }, [NcErrorType.PERMISSION_DENIED]: { diff --git a/packages/nocodb/src/services/columns.service.ts b/packages/nocodb/src/services/columns.service.ts index 1668774fad..472b44d4fc 100644 --- a/packages/nocodb/src/services/columns.service.ts +++ b/packages/nocodb/src/services/columns.service.ts @@ -388,7 +388,7 @@ export class ColumnsService { ); } catch (e) { console.error(e); - NcError.badRequest('Invalid Formula'); + throw e; } await Column.update(context, column.id, { @@ -1802,7 +1802,7 @@ export class ColumnsService { ); } catch (e) { console.error(e); - NcError.badRequest('Invalid Formula'); + throw e; } await Column.insert(context, {