Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
memoriav
M
Memobase 2020
S
services
postprocessing
Media Converter
Commits
9911f417
Unverified
Commit
9911f417
authored
Dec 07, 2020
by
Sebastian Schüpbach
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
print error message in report
parent
517c0dde
Pipeline
#18461
passed with stages
in 8 minutes and 17 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
15 deletions
+13
-15
src/main/scala/ch/memobase/App.scala
src/main/scala/ch/memobase/App.scala
+2
-2
src/main/scala/ch/memobase/models/ProcessingReport.scala
src/main/scala/ch/memobase/models/ProcessingReport.scala
+11
-13
No files found.
src/main/scala/ch/memobase/App.scala
View file @
9911f417
...
...
@@ -66,7 +66,7 @@ object App extends scala.App with Logging with RecordUtils {
processed
<-
recordProcessor
.
process
(
record
)
}
yield
(
record
,
processed
)
match
{
case
(
rec
,
ProcessSuccess
(
id
,
msg
))
=>
logger
.
debug
(
s
"$id: $msg"
)
logger
.
info
(
s
"$id: $msg"
)
reporter
.
send
(
ReportingObject
(
id
,
ProcessingSuccess
,
msg
,
getInstitutionAndRecordSet
(
rec
.
value
)))
case
(
rec
,
ProcessIgnore
(
id
,
msg
))
=>
logger
.
info
(
s
"$id: $msg"
)
...
...
@@ -77,7 +77,7 @@ object App extends scala.App with Logging with RecordUtils {
case
(
rec
,
ProcessFatal
(
id
,
msg
,
ex
))
=>
logger
.
error
(
s
"$id: $msg: ${ex.getMessage}"
)
logger
.
debug
(
ex
.
getStackTrace
.
mkString
(
"\n"
))
reporter
.
send
(
ReportingObject
(
id
,
ProcessingFatal
,
msg
,
getInstitutionAndRecordSet
(
rec
.
value
)))
reporter
.
send
(
ReportingObject
(
id
,
ProcessingFatal
,
s
"$msg: ${ex.getMessage}"
,
getInstitutionAndRecordSet
(
rec
.
value
)))
}
}
}
catch
{
...
...
src/main/scala/ch/memobase/models/ProcessingReport.scala
View file @
9911f417
...
...
@@ -46,24 +46,22 @@ case object ProcessingFatal extends ProcessingStatus {
case
class
ReportingObject
(
id
:
String
,
status
:
ProcessingStatus
,
message
:
String
,
institutionRecordSet
:
(
Option
[
String
],
Option
[
String
]))
{
import
ReportingObject.
_
import
ReportingObject.
createTimestamp
override
def
toString
:
String
=
s
"""{"step": "media-converter", "timestamp": "$createTimestamp", "id": "https://memobase.ch/digital/$id", "status": "${
status match {
case ProcessingSuccess => ProcessingSuccess.value
case ProcessingWarning => ProcessingWarning.value
case ProcessingIgnore => ProcessingIgnore.value
case ProcessingFatal => ProcessingFatal.value
}
}", "message": "${escapeApostrophes(message)}"}"""
ujson
.
write
(
ujson
.
Obj
(
(
"step"
,
"media-metadata-extractor"
),
(
"timestamp"
,
createTimestamp
),
(
"id"
,
id
),
(
"status"
,
status
.
value
),
(
"message"
,
message
)
)
)
}
object
ReportingObject
{
val
dateFormatter
=
new
SimpleDateFormat
(
"YYYY-MM-dd'T'HH:mm:ss.SSS"
)
private
val
dateFormatter
=
new
SimpleDateFormat
(
"YYYY-MM-dd'T'HH:mm:ss.SSS"
)
def
createTimestamp
:
String
=
dateFormatter
.
format
(
Calendar
.
getInstance
().
getTime
)
def
escapeApostrophes
(
value
:
String
)
:
String
=
value
.
replaceAll
(
"""""""
,
"""\\""""
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment