Skip to content

Commit

Permalink
better errors
Browse files Browse the repository at this point in the history
  • Loading branch information
AsterITA committed Jul 2, 2024
1 parent 743412a commit 2fa5d31
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1075,7 +1075,7 @@ final case class EServicesApiServiceImpl(

def checkZipStructure(folderPath: Path): Either[InvalidZipStructure, ImportedEservice] = {
def fileExists(filePath: Path): Either[InvalidZipStructure, Unit] = {
Either.cond(Files.exists(filePath), (), InvalidZipStructure(s"File in '$filePath' not found"))
Either.cond(Files.exists(filePath), (), InvalidZipStructure(s"File in $filePath not found"))
}

for {
Expand All @@ -1099,7 +1099,11 @@ final case class EServicesApiServiceImpl(
importedEservice.descriptor.interface.map(_.path.split("/").last)

val extraFiles = filePaths -- allowedFiles
Either.cond(extraFiles.isEmpty, (), InvalidZipStructure(s"Extra files found: ${extraFiles.mkString(", ")}"))
Either.cond(
extraFiles.isEmpty,
(),
InvalidZipStructure(s"Not allowed files found: ${extraFiles.mkString(", ")}")
)
}
} yield importedEservice
}
Expand Down

0 comments on commit 2fa5d31

Please sign in to comment.