Browse Source

fix: properly throw formula errors

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/9532/head
mertmit 1 month ago
parent
commit
a2f98af534
  1. 9
      packages/nocodb/src/helpers/catchError.ts
  2. 4
      packages/nocodb/src/services/columns.service.ts

9
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]: {

4
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, {

Loading…
Cancel
Save