Cleanup ignored exceptions

This commit is contained in:
Vishesh Handa
2020-01-27 18:39:16 +01:00
parent 21db481158
commit 6e2a905f05

View File

@ -118,28 +118,24 @@ class GitNoteRepository {
}
}
const ignoredMessages = [
'connection timed out',
'failed to resolve address for',
'failed to connect to',
'no address associated with hostname',
'unauthorized',
'invalid credentials',
'failed to start ssh session',
'failure while draining',
'network is unreachable',
];
bool shouldLogGitException(GitException ex) {
var msg = ex.cause.toLowerCase();
if (msg.contains("failed to resolve address for")) {
for (var i = 0; i < ignoredMessages.length; i++) {
if (msg.contains(ignoredMessages[i])) {
return false;
}
if (msg.contains("failed to connect to")) {
return false;
}
if (msg.contains("no address associated with hostname")) {
return false;
}
if (msg.contains("failed to connect to")) {
return false;
}
if (msg.contains("unauthorized")) {
return false;
}
if (msg.contains("invalid credentials")) {
return false;
}
if (msg.contains("failed to start ssh session")) {
return false;
}
return true;
}