Improved error logging.
This commit is contained in:
@@ -76,6 +76,7 @@ export async function BillsUploadMedia(req: Request, res: Response) {
|
|||||||
BillsListMedia(req, res);
|
BillsListMedia(req, res);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
logger.error("Error while uploading Bill Media", req.files, err);
|
||||||
res.status(500).send(err);
|
res.status(500).send(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ export async function JobsListMedia(req: Request, res: Response) {
|
|||||||
|
|
||||||
res.json(ret);
|
res.json(ret);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
logger.error("Error listing job media.", jobid, error);
|
||||||
res.status(500).json(error);
|
res.status(500).json(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,6 +57,16 @@ export async function JobsMoveMedia(req: Request, res: Response) {
|
|||||||
|
|
||||||
JobsListMedia(req, res);
|
JobsListMedia(req, res);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
logger.error(
|
||||||
|
"Error moving job media",
|
||||||
|
"from",
|
||||||
|
from_jobid,
|
||||||
|
"to",
|
||||||
|
jobid,
|
||||||
|
"files",
|
||||||
|
files,
|
||||||
|
err
|
||||||
|
);
|
||||||
res.status(500).send(err);
|
res.status(500).send(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ export async function jobsUploadMedia(req: Request, res: Response) {
|
|||||||
JobsListMedia(req, res);
|
JobsListMedia(req, res);
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
logger.error("Error uploading job media.", jobid, err);
|
||||||
res.status(500).send(err);
|
res.status(500).send(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ app.use(bodyParser.json({ limit: "50mb" }));
|
|||||||
app.use(bodyParser.urlencoded({ limit: "50mb", extended: true }));
|
app.use(bodyParser.urlencoded({ limit: "50mb", extended: true }));
|
||||||
|
|
||||||
app.use(cors());
|
app.use(cors());
|
||||||
|
|
||||||
const morganMiddleware = morgan(
|
const morganMiddleware = morgan(
|
||||||
"combined", //":method :url :status :res[content-length] - :response-time ms"
|
"combined", //":method :url :status :res[content-length] - :response-time ms"
|
||||||
{
|
{
|
||||||
@@ -117,7 +118,7 @@ const morganMiddleware = morgan(
|
|||||||
);
|
);
|
||||||
|
|
||||||
app.use(morganMiddleware);
|
app.use(morganMiddleware);
|
||||||
app.use(helmet());
|
app.use(helmet({ crossOriginResourcePolicy: { policy: "cross-origin" } }));
|
||||||
app.post("/jobs/list", ValidateImsToken, JobRequestValidator, JobsListMedia);
|
app.post("/jobs/list", ValidateImsToken, JobRequestValidator, JobsListMedia);
|
||||||
app.post(
|
app.post(
|
||||||
"/jobs/upload",
|
"/jobs/upload",
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export default async function GenerateThumbnail(
|
|||||||
}
|
}
|
||||||
return path.relative(path.dirname(file), thumbPath);
|
return path.relative(path.dirname(file), thumbPath);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error("Error when genenerating thumbnail:", thumbPath);
|
logger.error("Error when genenerating thumbnail:", thumbPath, err);
|
||||||
return path.relative(path.dirname(file), thumbPath);
|
return path.relative(path.dirname(file), thumbPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user