From d2af09133d3f62096e68ccd1212bed7efd24d163 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Sat, 17 Jun 2023 13:11:46 +0530 Subject: [PATCH] refactor: error code corrections Signed-off-by: Pranav C --- packages/nocodb/src/db/BaseModelSqlv2.ts | 12 ++++++------ packages/nocodb/src/services/data-table.service.ts | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index 7c12fdda91..071cb9b77d 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -3699,7 +3699,7 @@ class BaseModelSqlv2 { !childRows.find((r) => r[parentColumn.column_name] === id), ); - NcError.notFound( + NcError.unprocessableEntity( `Child record with id ${missingIds.join(', ')} not found`, ); } @@ -3777,7 +3777,7 @@ class BaseModelSqlv2 { !childRows.find((r) => r[parentColumn.column_name] === id), ); - NcError.notFound( + NcError.unprocessableEntity( `Child record with id ${missingIds.join(', ')} not found`, ); } @@ -3809,7 +3809,7 @@ class BaseModelSqlv2 { const childRow = await childRowsQb; if (!childRow) { - NcError.notFound(`Child record with id ${childIds[0]} not found`); + NcError.unprocessableEntity(`Child record with id ${childIds[0]} not found`); } } @@ -3899,7 +3899,7 @@ class BaseModelSqlv2 { !childRows.find((r) => r[parentColumn.column_name] === id), ); - NcError.notFound( + NcError.unprocessableEntity( `Child record with id ${missingIds.join(', ')} not found`, ); } @@ -3939,7 +3939,7 @@ class BaseModelSqlv2 { !childRows.find((r) => r[parentColumn.column_name] === id), ); - NcError.notFound( + NcError.unprocessableEntity( `Child record with id ${missingIds.join(', ')} not found`, ); } @@ -3969,7 +3969,7 @@ class BaseModelSqlv2 { const childRow = await childRowsQb; if (!childRow) { - NcError.notFound(`Child record with id ${childIds[0]} not found`); + NcError.unprocessableEntity(`Child record with id ${childIds[0]} not found`); } } diff --git a/packages/nocodb/src/services/data-table.service.ts b/packages/nocodb/src/services/data-table.service.ts index 6213e738a3..31f3920441 100644 --- a/packages/nocodb/src/services/data-table.service.ts +++ b/packages/nocodb/src/services/data-table.service.ts @@ -409,14 +409,14 @@ export class DataTableService { const map = new Map(); for (const rowId of rowIds) { if (rowId === undefined || rowId === null) - NcError.badRequest('Invalid row id ' + rowId); + NcError.unprocessableEntity('Invalid row id ' + rowId); if (map.has(rowId)) { - NcError.badRequest('Duplicate row with id ' + rowId); + NcError.unprocessableEntity('Duplicate row with id ' + rowId); } map.set(rowId, true); } } else if (rowIds === undefined || rowIds === null) { - NcError.badRequest('Invalid row id ' + rowIds); + NcError.unprocessableEntity('Invalid row id ' + rowIds); } } }