Atlas › Test

TestDefaultFailureConverterArbitraryError

Exact test identity: go.temporal.io/server/common/nexus/nexusrpc/TestDefaultFailureConverterArbitraryError

Package
go.temporal.io/server/common/nexus/nexusrpc
Suite / test hierarchy
TestDefaultFailureConverterArbitraryError
Test
TestDefaultFailureConverterArbitraryError
Introduced at
failure_converter.go ×1 Frontier kind: Joint frontier
Covered ranges
6
Covered lines
12
Covered files
1

Co-introduced tests

1 other test enter at the same concept.

Covered source

Expand a file to inspect source; the > gutter marks covered lines.

go.temporal.io/server/common/nexus/nexusrpc/failure_converter.go 12 covered LOC · 6 ranges

Open complete file

46 // ErrorToFailure implements FailureConverter.
47 // nolint:revive // Keeping all of the logic together for readability, even if it means the function is long.
48 > func (e knownErrorFailureConverter) ErrorToFailure(err error) (nexus.Failure, error) { failure_converter.go
49 > if err == nil {
50 return nexus.Failure{}, nil
51 }
52 // NOTE: not using errors.Unwrap here we are intentionally only supporting unwrapping known errors.
53 > switch typedErr := err.(type) { failure_converter.go
54 case *nexus.FailureError:
55 f := typedErr.Failure
123 }
124 return f, nil
125 > default: failure_converter.go
126 > return nexus.Failure{
127 > Message: typedErr.Error(),
128 > }, nil
129 }
130 }
132 // FailureToError implements FailureConverter.
133 // nolint:revive // Keeping all of the logic together for readability, even if it means the function is long.
134 > func (e knownErrorFailureConverter) FailureToError(f nexus.Failure) (error, error) { failure_converter.go
135 > if f.Metadata != nil {
136 switch f.Metadata["type"] {
137 case "nexus.HandlerError":
177 }
178 // Note that the original failure cause is retained on the FailureError's failure object.
179 > fe := &nexus.FailureError{Failure: f} failure_converter.go
180 > if f.Cause != nil {
181 c, err := e.FailureToError(*f.Cause)
182 if err != nil {