mirror of
https://github.com/Sebclem/hassio-nextcloud-backup.git
synced 2024-11-12 20:42:58 +01:00
Add more logs
This commit is contained in:
parent
f0e2125173
commit
8e77831e28
@ -57,11 +57,10 @@ configRouter.put("/webdav", (req, res) => {
|
|||||||
res.status(204).send();
|
res.status(204).send();
|
||||||
})
|
})
|
||||||
.catch((error: ValidationError) => {
|
.catch((error: ValidationError) => {
|
||||||
res.status(400);
|
|
||||||
if (error.details) {
|
if (error.details) {
|
||||||
res.json({ type: "validation", errors: error.details });
|
res.status(400).json({ type: "validation", errors: error.details });
|
||||||
} else {
|
} else {
|
||||||
res.json({ type: "validation", errors: error });
|
res.status(400).json({ type: "validation", errors: error });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -37,6 +37,7 @@ const create_snap_timeout = process.env.CREATE_BACKUP_TIMEOUT
|
|||||||
: 90 * 60 * 1000;
|
: 90 * 60 * 1000;
|
||||||
|
|
||||||
function getVersion(): Promise<Response<SupervisorResponse<CoreInfoBody>>> {
|
function getVersion(): Promise<Response<SupervisorResponse<CoreInfoBody>>> {
|
||||||
|
logger.info("Getting Home Assistant info");
|
||||||
return got<SupervisorResponse<CoreInfoBody>>("http://hassio/core/info", {
|
return got<SupervisorResponse<CoreInfoBody>>("http://hassio/core/info", {
|
||||||
headers: { authorization: `Bearer ${token}` },
|
headers: { authorization: `Bearer ${token}` },
|
||||||
responseType: "json",
|
responseType: "json",
|
||||||
@ -57,6 +58,7 @@ function getVersion(): Promise<Response<SupervisorResponse<CoreInfoBody>>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getAddonList(): Promise<Response<SupervisorResponse<AddonData>>> {
|
function getAddonList(): Promise<Response<SupervisorResponse<AddonData>>> {
|
||||||
|
logger.info("Getting Addon list");
|
||||||
const option: OptionsOfJSONResponseBody = {
|
const option: OptionsOfJSONResponseBody = {
|
||||||
headers: { authorization: `Bearer ${token}` },
|
headers: { authorization: `Bearer ${token}` },
|
||||||
responseType: "json",
|
responseType: "json",
|
||||||
|
@ -46,6 +46,7 @@ export function checkWebdavLogin(
|
|||||||
config: WebdavConfig,
|
config: WebdavConfig,
|
||||||
silent: boolean = false
|
silent: boolean = false
|
||||||
) {
|
) {
|
||||||
|
logger.info("Checking webdab login");
|
||||||
const endpoint = getEndpoint(config);
|
const endpoint = getEndpoint(config);
|
||||||
return got(config.url + endpoint, {
|
return got(config.url + endpoint, {
|
||||||
method: "OPTIONS",
|
method: "OPTIONS",
|
||||||
@ -64,7 +65,10 @@ export function checkWebdavLogin(
|
|||||||
},
|
},
|
||||||
(reason: RequestError) => {
|
(reason: RequestError) => {
|
||||||
if (!silent) {
|
if (!silent) {
|
||||||
messageManager.error("Fail to connect to Webdav", reason.message);
|
messageManager.error(
|
||||||
|
"Fail to connect to Webdav",
|
||||||
|
reason?.message ? reason.message : reason.code
|
||||||
|
);
|
||||||
}
|
}
|
||||||
const status = statusTools.getStatus();
|
const status = statusTools.getStatus();
|
||||||
status.webdav = {
|
status.webdav = {
|
||||||
@ -74,7 +78,7 @@ export function checkWebdavLogin(
|
|||||||
};
|
};
|
||||||
statusTools.setStatus(status);
|
statusTools.setStatus(status);
|
||||||
logger.error(`Fail to connect to Webdav`);
|
logger.error(`Fail to connect to Webdav`);
|
||||||
logger.error(reason);
|
logger.error(reason?.message ? reason.message : reason.code);
|
||||||
return Promise.reject(reason);
|
return Promise.reject(reason);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user