Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,13 @@ class SchemaDefinitionService(schemaRepository: ISchemaRepository, mappingReposi
.limit(1) // It is enough to take the first row to infer the schema.
} catch {
case e: FhirMappingException =>
// Remove the new lines and capitalize the error detail to show it in front-end properly.
throw BadRequest(e.getMessage, e.getCause.toString.capitalize.replace("\n", " "))
val simplifiedCause = Option(e.getCause).map(_.getMessage).map(_.replace("\n", " ")).getOrElse("")
val detail =
if (simplifiedCause.toLowerCase.contains("parquet") && simplifiedCause.toLowerCase.contains("not a parquet file"))
"Content type mismatch: the input file is not a valid Parquet file."
else
simplifiedCause.capitalize
throw BadRequest(e.getMessage, detail)
}
dataFrame.schema // Get the schema inferred by Spark
}
Expand Down
Loading