Error logging with stack trace

This commit is contained in:
La Programmatrice Verde
2025-08-25 10:55:20 +02:00
parent 407a428795
commit da58b9c573
2 changed files with 40 additions and 23 deletions

View File

@@ -42,12 +42,14 @@ async function isConnected(hostID) {
);
Log(`[${shared.now()}] ${hostID} connected: ${response.data.connected}`);
return response.data.connected;
}
catch (error) {
} catch (error) {
Log(
`[${shared.now()}] Errore nella verifica dello stato per l'host ${hostID}`
);
Log(`[${shared.now()}] ${error}`);
Log(`[${shared.now()}] Errore nella verifica dello stato per l'host ${hostID}`);
Log(`[${shared.now()}] Debug: ${error.stack}`);
process.exit(3);
}
}
}
async function initHostList() {
@@ -78,8 +80,10 @@ async function initHostList() {
});
} catch (error) {
Log(
`[${shared.now()}] Errore nella verifica e aggiunta al monitoraggio di un host: ${error}`
`[${shared.now()}] Errore nella verifica e aggiunta al monitoraggio di un host.`
);
Log(`[${shared.now()}] ${error}`);
Log(`[${shared.now()}] Debug: ${error.stack}`);
process.exit(3);
}
}
@@ -97,8 +101,10 @@ async function initHostList() {
hostIDs.push(response.data[0].id);
} catch (error) {
Log(
`[${shared.now()}] Errore nella verifica e aggiunta al monitoraggio di un host: ${error}`
`[${shared.now()}] Errore nella verifica e aggiunta al monitoraggio di un host.`
);
Log(`[${shared.now()}] ${error}`);
Log(`[${shared.now()}] Debug: ${error.stack}`);
process.exit(3);
}
}
@@ -124,8 +130,10 @@ async function initHostList() {
hostIDs.push(response.data.id);
} catch (error) {
Log(
`[${shared.now()}] Errore nella verifica e aggiunta al monitoraggio di un host: ${error}`
`[${shared.now()}] Errore nella verifica e aggiunta al monitoraggio di un host.`
);
Log(`[${shared.now()}] ${error}`);
Log(`[${shared.now()}] Debug: ${error.stack}`);
process.exit(3);
}
}
@@ -143,8 +151,10 @@ async function initHostList() {
hostIDs.push(response.data.id);
} catch (error) {
Log(
`[${shared.now()}] Errore nella verifica e aggiunta al monitoraggio di un host: ${error}`
`[${shared.now()}] Errore nella verifica e aggiunta al monitoraggio di un host.`
);
Log(`[${shared.now()}] ${error}`);
Log(`[${shared.now()}] Debug: ${error.stack}`);
process.exit(3);
}
}
@@ -164,8 +174,9 @@ async function initHostList() {
hostIDs.push(element.id);
});
} catch (error) {
Log(`[${shared.now()}] Errore nel tentativo di reperire tutti i peer.`);
Log(`[${shared.now()}] ${error}`);
Log(`[${shared.now()}] Errore nel tentativo di reperire tutti i peer`);
Log(`[${shared.now()}] Debug: ${error.stack}`);
process.exit(3);
}
}