[FEATURE} Adjust error handling and bump versions
This commit is contained in:
parent
d47a8c3cc4
commit
360dd32860
19 changed files with 1052 additions and 455 deletions
17
lib/routes/error-route.js
Normal file
17
lib/routes/error-route.js
Normal file
|
@ -0,0 +1,17 @@
|
|||
export function logErrors(err, req, res, next) {
|
||||
console.error(err.stack);
|
||||
next(err);
|
||||
}
|
||||
|
||||
export function clientErrorHandler(err, req, res, next) {
|
||||
if (req.xhr) {
|
||||
res.status(500).send({ error: "Something failed!" });
|
||||
} else {
|
||||
next(err);
|
||||
}
|
||||
}
|
||||
|
||||
export function errorHandler(err, req, res, next) {
|
||||
res.status(500);
|
||||
res.render("error", { error: err });
|
||||
}
|
2
lib/routes/react-route.js
vendored
2
lib/routes/react-route.js
vendored
|
@ -3,6 +3,6 @@ import path from "path";
|
|||
const router = Router();
|
||||
router.use("/", express.static(path.resolve("./build")));
|
||||
router.get("/*", (req, res) =>
|
||||
res.sendFile(path.resolve("./build/index.html"))
|
||||
res.sendFile(path.resolve("./build/index.html")),
|
||||
);
|
||||
export default router;
|
||||
|
|
|
@ -7,7 +7,7 @@ kc.loadFromDefault();
|
|||
const k8sApi = kc.makeApiClient(k8s.CoreV1Api);
|
||||
// Get Routes
|
||||
router.get("/available", (req, res) => {
|
||||
return res.json({cpu: 8000, memory: 16000});
|
||||
return res.json({ cpu: 8000, memory: 16000 });
|
||||
// TODO Workaround to detect available
|
||||
k8sApi.listNode().then((nodeRes) => {
|
||||
const nodeAllocatable = nodeRes.body.items.map((i) => i.status.allocatable);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue