50
}
51
52
>
func TruncateWithDepth(f *failurepb.Failure, maxSize, maxDepth int) *failurepb.Failure {
failure.go
53
>
if f == nil {
54
return nil
55
}
56
57
// note that bytes are given to earlier calls first, so call in order of importance
59
>
s = util.TruncateUTF8(s, maxSize)
60
>
maxSize -= len(s)
61
>
if s != "" {
62
>
maxSize -= 4 // account for proto overhead
63
>
}
64
>
return s
65
}
66
68
>
69
>
// Keep failure info for ApplicationFailureInfo and for ServerFailureInfo to persist NonRetryable flag.
70
>
if i := f.GetApplicationFailureInfo(); i != nil {
71
newFailure.FailureInfo = &failurepb.Failure_ApplicationFailureInfo{ApplicationFailureInfo: &failurepb.ApplicationFailureInfo{
72
NonRetryable: i.NonRetryable,