Skip to content

Commit

Permalink
Merge pull request #1303 from mfirry/issue-1285
Browse files Browse the repository at this point in the history
Adding handling for repos with missing README files. Fixes #1285
  • Loading branch information
adpi2 authored Nov 14, 2023
2 parents 13ec905 + d76165a commit b5a8aae
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package scaladex.client

import scala.concurrent.Future
import scala.scalajs.js
import scala.scalajs.js.JSConverters._
import scala.scalajs.js.UndefOr
Expand Down Expand Up @@ -47,7 +48,13 @@ object Client {
}
)
fetch(request).toFuture
.flatMap(res => res.text().toFuture)
.flatMap { res =>
if (res.status == 200) {
res.text().toFuture
} else {
Future.successful("No README found for this project, please check the repository")
}
}
.foreach { res =>
element.innerHTML = res

Expand Down

0 comments on commit b5a8aae

Please sign in to comment.