Added a proper error message for a missing library

This commit is contained in:
Šesták Vít
2017-06-28 09:15:55 +02:00
parent ffabc8a4e5
commit 420a765dc4
2 changed files with 9 additions and 4 deletions

View File

@@ -318,10 +318,10 @@ class Statistics @Inject()(
val (lastRefreshTime, resultsFuture) = projectReportsProvider.resultsForVersions(versions)
resultsFuture flatMap { allResults =>
select(allResults, selectorOption).fold(Future.successful(notFound())) { selection =>
Future.successful(Ok(views.html.library(
dep = selection.result.groupedDependenciesByHashes(depId),
selectorOption = selectorOption
)))
Future.successful(selection.result.groupedDependenciesByHashes.get(depId) match {
case None => NotFound(views.html.libraryNotFound(depId = depId, selectorOption = selectorOption))
case Some(dep) => Ok(views.html.library(dep = dep, selectorOption = selectorOption))
})
}
}
}

View File

@@ -0,0 +1,5 @@
@import com.ysoft.odc.Hashes
@(depId: Hashes, selectorOption: Option[String])(implicit header: DefaultRequest, mainTemplateData: MainTemplateData)
@main(title=s"Unknown library"){
There is no library found for hashes @depId.hashTuples.map{case (hashType, hashValue) => @hashType=@hashValue}.mkString(", "). It might have been removed or updated to a newer version.
}