Add logging of response if Gitea API Call fails

Signed-off-by: Fred Boniface <fred@fjla.uk>
This commit is contained in:
Fred Boniface 2023-03-02 20:56:47 +00:00
parent 4cb052b244
commit bb61180ab8
2 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,6 @@
const version = { const version = {
api: ["/api/v1/",], api: ["/api/v1/",],
app: "1.0.0" app: "1.0.1"
}; };
module.exports = version; module.exports = version;

View File

@ -6,7 +6,7 @@ async function processor(data) {
let out = {} let out = {}
out.title = data.subject.replace(/<[^>]+>|[\*\$]/g, ''); out.title = data.subject.replace(/<[^>]+>|[\*\$]/g, '');
out.body = data.msg.replace(/<[^>]+>|[\*\$]/g, '') out.body = data.msg.replace(/<[^>]+>|[\*\$]/g, '')
sendToGitea(out); return await sendToGitea(out);
} }
async function sendToGitea(body) { async function sendToGitea(body) {
@ -23,7 +23,7 @@ async function sendToGitea(body) {
log.out("issueService.sendToGitea: Issue sent to Gitea") log.out("issueService.sendToGitea: Issue sent to Gitea")
return {status: res.status,message:"issue created"} return {status: res.status,message:"issue created"}
} else { } else {
log.out("issueService.sendToGitea: Failed to send issue to Gitea") log.out(`issueService.sendToGitea: Failed to send issue to Gitea: ${res.body}`)
return {status: res.status,message:"issue not created"} return {status: res.status,message:"issue not created"}
} }
} }