Commit f38973eb authored by Jonas Waeber's avatar Jonas Waeber

Remove exit process and instead throw / rethrow errors.

parent eb920a7d
Pipeline #16167 passed with stage
in 2 minutes and 3 seconds
......@@ -23,7 +23,6 @@ import ch.memobase.mapping.fields.DirectMapField
import ch.memobase.mapping.fields.FieldParsers
import ch.memobase.mapping.fields.SimpleAnnotationField
import ch.memobase.mapping.mappers.DateFieldMapper
import kotlin.system.exitProcess
import mapping.MapperConfiguration
import mapping.MapperParsers
import mapping.mappers.AbstractFieldMapper
......@@ -58,22 +57,19 @@ class MappingConfigurationParser(data: ByteArray) {
else -> log.error("Top level definition of the mapping definition must be a map.")
}
}
} catch (ex: InvalidMappingException) {
log.error("Invalid Mapping: " + ex.message)
exitProcess(1)
} catch (ex: ClassCastException) {
log.error("Invalid Structure: " + ex.message)
exitProcess(1)
throw InvalidMappingException("Invalid Structure: " + ex.message)
}
if (uriField == "") {
log.error("Mapping is missing uri field in record, which is required.")
exitProcess(1)
throw InvalidMappingException("Mapping is missing uri field in record, which is required.")
}
if (localRecordType != null) {
recordType = localRecordType as SimpleAnnotationField
} else {
log.error("Mapping is missing record.type field which is required.")
exitProcess(1)
throw InvalidMappingException("Mapping is missing record.type field which is required.")
}
}
......
Markdown is supported
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