mirror of
https://github.com/Redume/Kekkai.git
synced 2025-02-23 20:51:25 +03:00
feat(server): Errors from postgresql are also now in a unified response style
Some checks are pending
Create and publish a Docker image / build-and-push-server (push) Waiting to run
Create and publish a Docker image / build-and-push-chart (push) Waiting to run
Create and publish a Docker image / build-and-push-CR (push) Waiting to run
Deploy docs / deploy (push) Waiting to run
Some checks are pending
Create and publish a Docker image / build-and-push-server (push) Waiting to run
Create and publish a Docker image / build-and-push-chart (push) Waiting to run
Create and publish a Docker image / build-and-push-CR (push) Waiting to run
Deploy docs / deploy (push) Waiting to run
This commit is contained in:
parent
0ae8fe3dea
commit
cd01af2eac
1 changed files with 38 additions and 28 deletions
|
@ -12,6 +12,8 @@ module.exports = async function getRateRoute(fastify) {
|
||||||
}
|
}
|
||||||
let rate_res;
|
let rate_res;
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
if (query['date'])
|
if (query['date'])
|
||||||
rate_res = await rate.getDay(
|
rate_res = await rate.getDay(
|
||||||
query['from_currency'],
|
query['from_currency'],
|
||||||
|
@ -34,6 +36,7 @@ module.exports = async function getRateRoute(fastify) {
|
||||||
'Read more in the documentation',
|
'Read more in the documentation',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if (typeof rate_res !== "object") return res.status(400).send({
|
if (typeof rate_res !== "object") return res.status(400).send({
|
||||||
status: 400,
|
status: 400,
|
||||||
message: rate_res,
|
message: rate_res,
|
||||||
|
@ -41,5 +44,12 @@ module.exports = async function getRateRoute(fastify) {
|
||||||
else return res.status(200).send(
|
else return res.status(200).send(
|
||||||
rate_res
|
rate_res
|
||||||
)
|
)
|
||||||
|
} catch (err) {
|
||||||
|
fastify.log.error(err.message);
|
||||||
|
res.status(500).send({
|
||||||
|
status: 500,
|
||||||
|
message: err.message
|
||||||
|
})
|
||||||
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue