Browse Source

fix: handle exceptions gracefully

pull/8855/head
Pranav C 5 months ago
parent
commit
9d50338e9e
  1. 15
      packages/nocodb/src/db/BaseModelSqlv2.ts

15
packages/nocodb/src/db/BaseModelSqlv2.ts

@ -5982,8 +5982,12 @@ class BaseModelSqlv2 {
if (!btAlias) { if (!btAlias) {
idToAliasPromiseMap[k] = Column.get(this.context, { idToAliasPromiseMap[k] = Column.get(this.context, {
colId: k, colId: k,
}).then((col) => { })
.then((col) => {
return col.title; return col.title;
})
.catch((e) => {
return Promise.resolve(e);
}); });
} }
} }
@ -5993,8 +5997,12 @@ class BaseModelSqlv2 {
if (!btAlias) { if (!btAlias) {
idToAliasPromiseMap[col.id] = Column.get(this.context, { idToAliasPromiseMap[col.id] = Column.get(this.context, {
colId: col.id, colId: col.id,
}).then((col) => { })
.then((col) => {
return col.title; return col.title;
})
.catch((e) => {
return Promise.resolve(e);
}); });
} }
} }
@ -6006,6 +6014,9 @@ class BaseModelSqlv2 {
for (const k of Object.keys(idToAliasPromiseMap)) { for (const k of Object.keys(idToAliasPromiseMap)) {
idToAliasMap[k] = await idToAliasPromiseMap[k]; idToAliasMap[k] = await idToAliasPromiseMap[k];
if ((idToAliasMap[k] as unknown) instanceof Error) {
throw idToAliasMap[k];
}
} }
data.forEach((item) => { data.forEach((item) => {

Loading…
Cancel
Save