Skip to content

Commit

Permalink
igluctl: fix false failure message in push command (close #313)
Browse files Browse the repository at this point in the history
  • Loading branch information
oguzhanunlu committed Apr 6, 2018
1 parent 9abdc6d commit f5491e9
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,9 @@ object PushCommand {
* @param message human-readable message
* @param location optional URI available for successful upload
*/
case class ServerMessage(status: Int, message: String, location: Option[String]) {
def asString: String =
case class ServerMessage(status: Int, message: String, location: Option[String])
object ServerMessage {
def asString(status: Int, message: String, location: Option[String]): String =
s"$message ${location.map("at " + _ + " ").getOrElse("")} ($status)"
}

Expand All @@ -256,7 +257,7 @@ object PushCommand {
case class Result(serverMessage: Either[String, ServerMessage], status: Status) {
def asString: String =
serverMessage match {
case Right(message) => message.asString
case Right(message) => ServerMessage.asString(message.status, message.message, message.location)
case Left(responseBody) => responseBody
}
}
Expand Down

0 comments on commit f5491e9

Please sign in to comment.