Browse Source

refactor: on list/read api error return status 500

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/4696/head
Pranav C 2 years ago
parent
commit
4e80443bd3
  1. 11
      packages/nocodb/src/lib/meta/api/dataApis/dataAliasApis.ts
  2. 8
      packages/nocodb/src/lib/meta/api/dataApis/dataApis.ts

11
packages/nocodb/src/lib/meta/api/dataApis/dataAliasApis.ts

@ -124,8 +124,10 @@ async function getDataList(model, view: View, req) {
);
count = await baseModel.count(listArgs);
} catch (e) {
// show empty result instead of throwing error here
// e.g. search some text in a numeric field
console.log(e);
NcError.internalServerError(
'Internal Server Error, check server log for more details'
);
}
return new PagedResponseImpl(data, {
@ -281,8 +283,9 @@ async function getGroupedDataList(model, view: View, req) {
});
} catch (e) {
console.log(e);
// show empty result instead of throwing error here
// e.g. search some text in a numeric field
NcError.internalServerError(
'Internal Server Error, check server log for more details'
);
}
return data;
}

8
packages/nocodb/src/lib/meta/api/dataApis/dataApis.ts

@ -328,7 +328,9 @@ async function dataRead(req: Request, res: Response, next) {
);
} catch (e) {
console.log(e);
res.status(500).json({ msg: e.message });
NcError.internalServerError(
'Internal Server Error, check server log for more details'
);
}
}
@ -465,6 +467,10 @@ async function getDataList(model, view: View, req) {
} catch (e) {
// show empty result instead of throwing error here
// e.g. search some text in a numeric field
console.log(e);
NcError.internalServerError(
'Internal Server Error, check server log for more details'
);
}
return new PagedResponseImpl(data, {

Loading…
Cancel
Save