parent
58e4191698
commit
5ab094ff61
|
@ -30,7 +30,7 @@ object Bot extends LilaController {
|
|||
cmd.split('/') match {
|
||||
case Array("account", "upgrade") =>
|
||||
lila.user.UserRepo.setBot(me) >>- Env.user.lightUserApi.invalidate(me.id) inject jsonOkResult recover {
|
||||
case e: lila.common.base.LilaException => BadRequest(jsonError(e.getMessage))
|
||||
case e: lila.base.LilaException => BadRequest(jsonError(e.getMessage))
|
||||
}
|
||||
case Array("game", id, "chat") => WithBot(me) {
|
||||
Env.bot.form.chat.bindFromRequest.fold(
|
||||
|
@ -43,14 +43,14 @@ object Bot extends LilaController {
|
|||
case Array("game", id, "abort") => WithBot(me) {
|
||||
WithMyBotGame(id, me) { pov =>
|
||||
Env.bot.player.abort(pov) inject jsonOkResult recover {
|
||||
case e: lila.common.base.LilaException => BadRequest(e.getMessage)
|
||||
case e: lila.base.LilaException => BadRequest(e.getMessage)
|
||||
}
|
||||
}
|
||||
}
|
||||
case Array("game", id, "resign") => WithBot(me) {
|
||||
WithMyBotGame(id, me) { pov =>
|
||||
Env.bot.player.resign(pov) inject jsonOkResult recover {
|
||||
case e: lila.common.base.LilaException => BadRequest(e.getMessage)
|
||||
case e: lila.base.LilaException => BadRequest(e.getMessage)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -108,7 +108,7 @@ object Coach extends LilaController {
|
|||
OptionFuResult(api findOrInit me) { c =>
|
||||
ctx.body.body.file("picture") match {
|
||||
case Some(pic) => api.uploadPicture(c, pic) recover {
|
||||
case e: lila.common.base.LilaException => BadRequest(html.coach.picture(c, e.message.some))
|
||||
case e: lila.base.LilaException => BadRequest(html.coach.picture(c, e.message.some))
|
||||
} inject Redirect(routes.Coach.edit)
|
||||
case None => fuccess(Redirect(routes.Coach.edit))
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ object Streamer extends LilaController {
|
|||
AsStreamer { s =>
|
||||
ctx.body.body.file("picture") match {
|
||||
case Some(pic) => api.uploadPicture(s.streamer, pic) recover {
|
||||
case e: lila.common.base.LilaException => BadRequest(html.streamer.picture(s, e.message.some))
|
||||
case e: lila.base.LilaException => BadRequest(html.streamer.picture(s, e.message.some))
|
||||
} inject Redirect(routes.Streamer.edit)
|
||||
case None => fuccess(Redirect(routes.Streamer.edit))
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ import ornicar.scalalib
|
|||
import org.joda.time.DateTime
|
||||
import com.typesafe.config.Config
|
||||
import play.api.libs.json.{ JsObject, JsValue }
|
||||
import lila.common.base._
|
||||
import lila.base._
|
||||
|
||||
trait Lilaisms
|
||||
extends LilaTypes
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package lila.common.base
|
||||
package lila.base
|
||||
|
||||
import ornicar.scalalib.ValidTypes._
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package lila.common.base
|
||||
package lila.base
|
||||
|
||||
import scala.concurrent.duration.Duration
|
||||
import scala.concurrent.Future
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package lila.common.base
|
||||
package lila.base
|
||||
|
||||
import scala.concurrent.duration._
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package lila.common.base
|
||||
package lila.base
|
||||
|
||||
import LilaTypes._
|
||||
import ornicar.scalalib.Zero
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package lila.common.base
|
||||
package lila.base
|
||||
|
||||
import play.api.libs.json._
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package lila.common.base
|
||||
package lila.base
|
||||
|
||||
import java.lang.Math.{ min, max }
|
||||
import scala.concurrent.ExecutionContext
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package lila.common.base
|
||||
package lila.base
|
||||
|
||||
import java.util.Base64
|
||||
import java.lang.{ StringBuilder => jStringBuilder }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package lila.common.base
|
||||
package lila.base
|
||||
|
||||
import java.util.concurrent.TimeUnit
|
||||
import scala.concurrent.duration._
|
||||
|
|
|
@ -170,7 +170,7 @@ final class FishnetApi(
|
|||
|
||||
object FishnetApi {
|
||||
|
||||
import lila.common.base.LilaException
|
||||
import lila.base.LilaException
|
||||
|
||||
case object WeakAnalysis extends LilaException {
|
||||
val message = "Analysis nodes per move is too low"
|
||||
|
|
|
@ -7,7 +7,7 @@ import scalaz.Validation.success
|
|||
import scalaz.Validation.FlatMap._
|
||||
|
||||
import lila.analyse.{ Analysis, Info, PgnMove }
|
||||
import lila.common.base.LilaException
|
||||
import lila.base.LilaException
|
||||
|
||||
// convert variations from UCI to PGN.
|
||||
// also drops extra variations
|
||||
|
|
|
@ -46,7 +46,7 @@ final class EarlyMultiThrottler(
|
|||
work.timeout.orElse(executionTimeout).fold(work.run()) { timeout =>
|
||||
work.run().withTimeout(
|
||||
duration = timeout,
|
||||
error = lila.common.base.LilaException(s"EarlyMultiThrottler timed out after $timeout")
|
||||
error = lila.base.LilaException(s"EarlyMultiThrottler timed out after $timeout")
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ object FutureSequencer {
|
|||
|
||||
import scala.util.Try
|
||||
|
||||
case class Timeout(duration: FiniteDuration) extends lila.common.base.LilaException {
|
||||
case class Timeout(duration: FiniteDuration) extends lila.base.LilaException {
|
||||
val message = s"FutureSequencer timed out after $duration"
|
||||
}
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ final class LateMultiThrottler(
|
|||
timeoutOption.orElse(executionTimeout).fold(run()) { timeout =>
|
||||
run().withTimeout(
|
||||
duration = timeout,
|
||||
error = lila.common.base.LilaException(s"LateMultiThrottler timed out after $timeout")
|
||||
error = lila.base.LilaException(s"LateMultiThrottler timed out after $timeout")
|
||||
)
|
||||
} addEffectAnyway {
|
||||
self ! Done(id)
|
||||
|
|
|
@ -45,7 +45,7 @@ final class Sequencer(
|
|||
val future = timeoutOption.orElse(executionTimeout).fold(run()) { timeout =>
|
||||
run().withTimeout(
|
||||
duration = timeout,
|
||||
error = lila.common.base.LilaException(s"Sequencer timed out after $timeout")
|
||||
error = lila.base.LilaException(s"Sequencer timed out after $timeout")
|
||||
)(context.system)
|
||||
} addEffectAnyway {
|
||||
self ! Done
|
||||
|
|
|
@ -5,7 +5,7 @@ import scala.util.Try
|
|||
|
||||
import akka.actor._
|
||||
|
||||
import lila.common.base.LilaException
|
||||
import lila.base.LilaException
|
||||
|
||||
trait SequentialActor extends Actor {
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import scala.util.Try
|
|||
import akka.actor._
|
||||
import akka.pattern.pipe
|
||||
|
||||
import lila.common.base.LilaException
|
||||
import lila.base.LilaException
|
||||
|
||||
trait SequentialProvider extends Actor {
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ object AsyncCache {
|
|||
) = {
|
||||
val safeF = (k: K) => f(k).withTimeout(
|
||||
resultTimeout,
|
||||
lila.common.base.LilaException(s"AsyncCache.multi $name key=$k timed out after $resultTimeout")
|
||||
lila.base.LilaException(s"AsyncCache.multi $name key=$k timed out after $resultTimeout")
|
||||
)
|
||||
val cache: AsyncLoadingCache[K, V] = makeExpire(
|
||||
Scaffeine().maximumSize(maxCapacity),
|
||||
|
@ -78,7 +78,7 @@ object AsyncCache {
|
|||
val fullName = s"AsyncCache.clearable $name"
|
||||
val safeF = (k: K) => f(k).withTimeout(
|
||||
resultTimeout,
|
||||
lila.common.base.LilaException(s"$fullName key=$k timed out after $resultTimeout")
|
||||
lila.base.LilaException(s"$fullName key=$k timed out after $resultTimeout")
|
||||
)
|
||||
val cache: Cache[K, Fu[V]] = makeExpire(
|
||||
Scaffeine().maximumSize(maxCapacity),
|
||||
|
@ -96,7 +96,7 @@ object AsyncCache {
|
|||
) = {
|
||||
val safeF = (_: Unit) => f.withTimeout(
|
||||
resultTimeout,
|
||||
lila.common.base.LilaException(s"AsyncCache.single $name single timed out after $resultTimeout")
|
||||
lila.base.LilaException(s"AsyncCache.single $name single timed out after $resultTimeout")
|
||||
)
|
||||
val cache: AsyncLoadingCache[Unit, V] = makeExpire(
|
||||
Scaffeine().maximumSize(1),
|
||||
|
|
|
@ -89,7 +89,7 @@ final class Syncache[K, V](
|
|||
private val loadFunction = new java.util.function.Function[K, Fu[V]] {
|
||||
def apply(k: K) = compute(k).withTimeout(
|
||||
duration = resultTimeout,
|
||||
error = lila.common.base.LilaException(s"Syncache $name $k timed out after $resultTimeout")
|
||||
error = lila.base.LilaException(s"Syncache $name $k timed out after $resultTimeout")
|
||||
)
|
||||
.mon(_ => recComputeNanos) // monitoring: record async time
|
||||
.addEffects(
|
||||
|
|
|
@ -54,7 +54,7 @@ object OAuthServer {
|
|||
|
||||
type AuthResult = Either[AuthError, OAuthScope.Scoped]
|
||||
|
||||
sealed abstract class AuthError(val message: String) extends lila.common.base.LilaException
|
||||
sealed abstract class AuthError(val message: String) extends lila.base.LilaException
|
||||
case object ServerOffline extends AuthError("OAuth server is offline! Try again soon.")
|
||||
case object MissingAuthorizationHeader extends AuthError("Missing authorization header")
|
||||
case object InvalidAuthorizationHeader extends AuthError("Invalid authorization header")
|
||||
|
|
|
@ -82,7 +82,7 @@ private[puzzle] final class Selector(
|
|||
|
||||
private final object Selector {
|
||||
|
||||
case object NoPuzzlesAvailableException extends lila.common.base.LilaException {
|
||||
case object NoPuzzlesAvailableException extends lila.base.LilaException {
|
||||
val message = "No puzzles available"
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ import play.api.libs.ws.{ WS, WSResponse }
|
|||
import play.api.Play.current
|
||||
import scala.concurrent.duration._
|
||||
|
||||
import lila.common.base.LilaException
|
||||
import lila.base.LilaException
|
||||
import lila.study.MultiPgn
|
||||
import lila.tree.Node.Comments
|
||||
|
||||
|
@ -133,7 +133,7 @@ private object RelayFetch {
|
|||
case Upstream.DgtOneFile(file) => dgtOneFile(file, max)
|
||||
case Upstream.DgtManyFiles(dir) =>
|
||||
dgtManyFiles(dir, max, DgtMany.RoundPgn) recoverWith {
|
||||
case _: lila.common.base.LilaException => dgtManyFiles(dir, max, DgtMany.Indexjson)
|
||||
case _: lila.base.LilaException => dgtManyFiles(dir, max, DgtMany.Indexjson)
|
||||
}
|
||||
}) flatMap multiPgnToGames.apply
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ object Forecast {
|
|||
|
||||
implicit val forecastJsonWriter = Json.writes[Forecast]
|
||||
|
||||
case object OutOfSync extends lila.common.base.LilaException {
|
||||
case object OutOfSync extends lila.base.LilaException {
|
||||
val message = "Forecast out of sync"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ package object round extends PackageObject with WithSocket {
|
|||
|
||||
package round {
|
||||
|
||||
private[round] sealed trait BenignError extends lila.common.base.LilaException
|
||||
private[round] sealed trait BenignError extends lila.base.LilaException
|
||||
private[round] case class ClientError(message: String) extends BenignError
|
||||
private[round] case class FishnetError(message: String) extends BenignError
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ final class DisposableEmailDomain(
|
|||
private[security] def refresh: Unit = {
|
||||
WS.url(providerUrl).get() map { res =>
|
||||
res.json.validate[Set[String]].fold(
|
||||
err => onError(lila.common.base.LilaException(err.toString)),
|
||||
err => onError(lila.base.LilaException(err.toString)),
|
||||
dat => {
|
||||
domains = dat
|
||||
failed = false
|
||||
|
|
|
@ -242,7 +242,7 @@ object Node {
|
|||
implicit val gamebookWriter = Json.writes[Node.Gamebook]
|
||||
import Eval.JsonHandlers.evalWrites
|
||||
|
||||
@inline implicit private def toPimpedJsObject(jo: JsObject) = new lila.common.base.PimpedJsObject(jo)
|
||||
@inline implicit private def toPimpedJsObject(jo: JsObject) = new lila.base.PimpedJsObject(jo)
|
||||
|
||||
def makeNodeJsonWriter(alwaysChildren: Boolean): Writes[Node] = Writes { node =>
|
||||
import node._
|
||||
|
|
Loading…
Reference in New Issue