in magenta-lib/src/main/scala/magenta/tasks/gcp/GCP.scala [228:241]
protected def when500orGoogleError(throwable: Throwable): Boolean = {
throwable match {
case t: GoogleJsonResponseException => {
((t.getStatusCode == 403 || t.getStatusCode == 429) && t.getDetails.getErrors.asScala.head.getDomain
.equalsIgnoreCase("usageLimits")) ||
(t.getStatusCode == 400 && t.getDetails.getErrors.asScala.head.getReason
.equalsIgnoreCase("invalid")) ||
t.getStatusCode / 100 == 5
}
case t: HttpResponseException => t.getStatusCode / 100 == 5
case ioe: IOException => true
case _ => false
}
}