Commit 742df4af authored by Jonas Waeber's avatar Jonas Waeber
Browse files

Improve logging

parent ac994493
Pipeline #33859 passed with stages
in 3 minutes and 34 seconds
......@@ -31,8 +31,8 @@ object ReportMessages {
return "File Extension Error: Not a valid file extension: $fileName."
}
fun sftpException(message: String): String {
return "SFTP Exception: $message."
fun sftpException(fileName: String, message: String): String {
return "SFTP Exception: $message ($fileName)."
}
fun formatError(path: String, format: AcceptedFileFormat, message: String): String {
......
......@@ -108,7 +108,7 @@ class Service(fileName: String = "app.yml") {
val report = Report(
"$recordSetId#$sessionId",
status = ReportStatus.fatal,
message = ReportMessages.sftpException(ex.localizedMessage),
message = ReportMessages.sftpException(ex.localizedMessage, basePath),
step = step
)
producer.sendReport(report)
......@@ -132,11 +132,11 @@ class Service(fileName: String = "app.yml") {
reportCount += 1
}
} catch (ex: SftpClientException) {
log.error(ReportMessages.sftpException(ex.localizedMessage))
log.error(ReportMessages.sftpException(ex.localizedMessage, basePath))
val report = Report(
file.name,
status = ReportStatus.fatal,
message = ReportMessages.sftpException(ex.localizedMessage),
message = ReportMessages.sftpException(ex.localizedMessage, basePath),
step = step
)
producer.sendReport(report)
......@@ -151,11 +151,10 @@ class Service(fileName: String = "app.yml") {
Report(
"$recordSetId#$sessionId",
status = ReportStatus.fatal,
message = ReportMessages.sftpException(ex.localizedMessage),
message = ReportMessages.sftpException(ex.localizedMessage, basePath),
step = step
)
)
exitProcess(1)
} catch (ex: Exception) {
log.error("${ex.javaClass.canonicalName}: ${ex.localizedMessage}.")
producer.sendReport(
......@@ -166,7 +165,6 @@ class Service(fileName: String = "app.yml") {
step = step
)
)
exitProcess(1)
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment