alpakka
alpakka copied to clipboard
Show useful information when failing on redirect
#312 introduced code that failed when a redirect response code was returned. However, there is nothing useful in the exception name or message that even states that this is a redirect, let alone how to resolve the issue. For example, if you log the error out to logback or something like that, this is what gets printed:
akka.stream.alpakka.s3.S3Exception:
at akka.stream.alpakka.s3.S3Exception$.apply(S3Exception.scala:41)
at akka.stream.alpakka.s3.impl.S3Stream$.$anonfun$unmarshalError$1(S3Stream.scala:614)
at scala.util.Success.map(Try.scala:262)
...
Completely useless. Outputting S3Exception.toString
is only marginally better:
akka.stream.alpakka.s3.S3Exception: (Status code: 301 Moved Permanently, Code: 301 Moved Permanently, RequestId: -, Resource: -)
The exception message should state that a redirect response code was returned, and the value of the Location
header should be included in the message, so that we can have some idea of what we're being redirected to, which should help to explain how to address the issue.