Skip to content

Commit

Permalink
Merge pull request #8 from mausch/patch-1
Browse files Browse the repository at this point in the history
Fix error description when deserializing container configuration
  • Loading branch information
almoehi committed May 27, 2015
2 parents 50a22b7 + d37532c commit 5cc0b0b
Showing 1 changed file with 3 additions and 3 deletions.
Expand Up @@ -33,17 +33,17 @@ object ContainerConfig {
val res = Json.fromJson[ContainerConfiguration](json)(fmt)
res.asOpt match {
case Some(c) => c
case _ => throw new RuntimeException(s"failed to serialize container config to json: " + Json.prettyPrint(json))
case _ => throw new RuntimeException(s"failed to deserialize container config from json: " + Json.prettyPrint(json))
}
}

def apply(json: String)(implicit fmt: Format[ContainerConfiguration]): ContainerConfiguration = {
val res = Json.fromJson[ContainerConfiguration](Json.parse(json))(fmt)
res.asOpt match {
case Some(c) => c
case _ => throw new RuntimeException(s"failed to serialize container config to json: " + json)
case _ => throw new RuntimeException(s"failed to deserialize container config from json: " + json)
}
}

def apply(image: String, cmd: Seq[String]): ContainerConfiguration = ContainerConfiguration(Some(image), Some(cmd))
}
}

0 comments on commit 5cc0b0b

Please sign in to comment.