How to know, if unmarshell was successful or not

Hi all

I have a route, that will unmarshell the incoming entity into a case class.

final case class ProducerMessage(topic: String, event: String, data: spray.json.JsObject)

object ProducerServer {

  private val route: Route =   
    path("producer") {
        post {
          entity(as[ProducerMessage]) { msg =>
            //complete(HttpEntity(ContentTypes.`text/html(UTF-8)`, "<h1>Say hello to akka-http</h1>"))

  def create(): Future[ServerBinding] {
    Http().bindAndHandle(route, getServerIp, getServerPort)


How do I know, if the process of unmarshell was successfully or not? When received data is not a valid JSON format, what happen then?