Update debug messages
This commit is contained in:
parent
0085f16a12
commit
4b67191aab
@ -18,10 +18,10 @@ export default function handler(req: NextApiRequest, res: NextApiResponse<string
|
|||||||
try {
|
try {
|
||||||
const path = resolve("./public", "projects", "list.json");
|
const path = resolve("./public", "projects", "list.json");
|
||||||
const data = readFileSync(path).toString();
|
const data = readFileSync(path).toString();
|
||||||
console.debug("[API/get_project]\tRequest for project list");
|
console.debug("[API/projects]\tRequest for project list");
|
||||||
res.status(200).send(data);
|
res.status(200).send(data);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(`[API/get_project]\tError in request for project list! Code: ${(err as IFileError).code}`);
|
console.error(`[API/projects]\tError in request for project list! Code: ${(err as IFileError).code}`);
|
||||||
res.status(500);
|
res.status(500);
|
||||||
} finally {
|
} finally {
|
||||||
res.end();
|
res.end();
|
||||||
|
@ -21,10 +21,10 @@ export default function handler(req: NextApiRequest, res: NextApiResponse<string
|
|||||||
try {
|
try {
|
||||||
const path = resolve("./public", "projects", `${project}.adoc`);
|
const path = resolve("./public", "projects", `${project}.adoc`);
|
||||||
const data = readFileSync(path).toString();
|
const data = readFileSync(path).toString();
|
||||||
console.debug(`[API/get_project]\tRequest for ${project}`);
|
console.debug(`[API/projects]\tRequest for ${project}`);
|
||||||
res.status(200).send(data);
|
res.status(200).send(data);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(`[API/get_project]\tError in request for ${project}! Code: ${(err as IFileError).code}`);
|
console.error(`[API/projects]\tError in request for ${project}! Code: ${(err as IFileError).code}`);
|
||||||
if ((err as IFileError).code === "ENOENT") res.status(404);
|
if ((err as IFileError).code === "ENOENT") res.status(404);
|
||||||
else res.status(500);
|
else res.status(500);
|
||||||
} finally {
|
} finally {
|
||||||
|
Loading…
Reference in New Issue
Block a user