mirror of
https://github.com/Sebclem/hassio-nextcloud-backup.git
synced 2024-11-25 02:22: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();
|
||||
})
|
||||
.catch((error: ValidationError) => {
|
||||
res.status(400);
|
||||
if (error.details) {
|
||||
res.json({ type: "validation", errors: error.details });
|
||||
res.status(400).json({ type: "validation", errors: error.details });
|
||||
} 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;
|
||||
|
||||
function getVersion(): Promise<Response<SupervisorResponse<CoreInfoBody>>> {
|
||||
logger.info("Getting Home Assistant info");
|
||||
return got<SupervisorResponse<CoreInfoBody>>("http://hassio/core/info", {
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
responseType: "json",
|
||||
@ -57,6 +58,7 @@ function getVersion(): Promise<Response<SupervisorResponse<CoreInfoBody>>> {
|
||||
}
|
||||
|
||||
function getAddonList(): Promise<Response<SupervisorResponse<AddonData>>> {
|
||||
logger.info("Getting Addon list");
|
||||
const option: OptionsOfJSONResponseBody = {
|
||||
headers: { authorization: `Bearer ${token}` },
|
||||
responseType: "json",
|
||||
|
@ -46,6 +46,7 @@ export function checkWebdavLogin(
|
||||
config: WebdavConfig,
|
||||
silent: boolean = false
|
||||
) {
|
||||
logger.info("Checking webdab login");
|
||||
const endpoint = getEndpoint(config);
|
||||
return got(config.url + endpoint, {
|
||||
method: "OPTIONS",
|
||||
@ -64,7 +65,10 @@ export function checkWebdavLogin(
|
||||
},
|
||||
(reason: RequestError) => {
|
||||
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();
|
||||
status.webdav = {
|
||||
@ -74,7 +78,7 @@ export function checkWebdavLogin(
|
||||
};
|
||||
statusTools.setStatus(status);
|
||||
logger.error(`Fail to connect to Webdav`);
|
||||
logger.error(reason);
|
||||
logger.error(reason?.message ? reason.message : reason.code);
|
||||
return Promise.reject(reason);
|
||||
}
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user