You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
762 B
25 lines
762 B
package controllers.common
|
|
|
|
import com.alexitc.playsonify.AbstractJsonController
|
|
import com.alexitc.playsonify.models.{ErrorId, ServerError}
|
|
import org.slf4j.LoggerFactory
|
|
|
|
abstract class MyJsonController(cc: MyJsonControllerComponents) extends AbstractJsonController[Nothing](cc) {
|
|
|
|
protected val logger = LoggerFactory.getLogger(this.getClass)
|
|
|
|
override def onServerError(error: ServerError, errorId: ErrorId): Unit = {
|
|
val message = s"Unexpected server error, id = ${errorId.string}, error = $error"
|
|
|
|
error
|
|
.cause
|
|
.orElse {
|
|
logger.warn(message)
|
|
None
|
|
}
|
|
.foreach { cause =>
|
|
// we'll log as error when there is an exception involved
|
|
logger.error(message, cause)
|
|
}
|
|
}
|
|
}
|
|
|