All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.elasticmq.rest.sqs.directives.RejectionDirectives.scala Maven / Gradle / Ivy

The newest version!
package org.elasticmq.rest.sqs.directives

import akka.http.scaladsl.server.{Directive0, Directives, Rejection, RejectionHandler}
import org.elasticmq.rest.sqs.SQSException

trait RejectionDirectives {
  this: Directives with ExceptionDirectives =>

  val rejectionHandler: RejectionHandler = RejectionHandler
    .newBuilder()
    .handleAll[Rejection] { rejections =>
      handleServerExceptions { _ =>
        throw new SQSException("Invalid request: " + rejections.map(_.toString).mkString(", "))
      }
    }
    .result()

  def handleRejectionsWithSQSError: Directive0 = handleRejections(rejectionHandler)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy