akka.stream.alpakka.s3.S3Exception.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of akka-stream-alpakka-s3_2.11 Show documentation
Show all versions of akka-stream-alpakka-s3_2.11 Show documentation
Alpakka is a Reactive Enterprise Integration library for Java and Scala, based on Reactive Streams and Akka.
/*
* Copyright (C) 2016-2018 Lightbend Inc.
*/
package akka.stream.alpakka.s3
import scala.xml.{Elem, XML}
class S3Exception(val code: String, val message: String, val requestId: String, val hostId: String)
extends RuntimeException(message) {
def this(xmlResponse: Elem) =
this((xmlResponse \ "Code").text,
(xmlResponse \ "Message").text,
(xmlResponse \ "RequestID").text,
(xmlResponse \ "HostID").text)
def this(response: String) = this(XML.loadString(response))
override def toString = s"${super.toString} (Code: $code, RequestID: $requestId, HostID: $hostId)"
}