You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// K8sFailure is not an Exception which means an attempt to directly log it as a Cause will, by default, lose transitive causal information
59
+
// because we only log k8s communication failures and then report the pod as healthy, we want to propagate as much information as possible to users
60
+
// therefore we convert K8sFailure to an exception, keeping transitive causes in some form whenever they're available, and creating friendlier messages for the rest
61
+
privatedefasException(k8sFailure: K8sFailure) =
62
+
k8sFailure match {
63
+
caseUnauthorized(requestInfo, message) =>
64
+
newK8sException(s"unauthorized trying to ${toLogString(requestInfo)}: $message")
65
+
66
+
caseHttpFailure(requestInfo, message, code) =>
67
+
newK8sException(s"http failure $code trying to ${toLogString(requestInfo)}: $message")
68
+
69
+
caseDecodedFailure(requestInfo, status, code) =>
70
+
newK8sException(s"decoded failure $code trying to ${toLogString(requestInfo)}: ${toLogString(status)}")
71
+
72
+
caseDeserializationFailure(requestInfo, error) =>
73
+
error.tail.foldLeft(
74
+
newK8sException(s"deserialization failure trying to ${toLogString(requestInfo)}", error.head)
75
+
) { (result, e) =>
76
+
result.addSuppressed(e)
77
+
result
78
+
}
79
+
80
+
caseRequestFailure(requestInfo, reason) =>
81
+
newK8sException(s"request failure trying to ${toLogString(requestInfo)}", reason)
82
+
83
+
caseInvalidEvent(requestInfo, eventType) =>
84
+
newK8sException(s"invalid event $eventType trying to ${toLogString(requestInfo)}")
0 commit comments