Conversation
nexus/failure.go
Outdated
| // By default the SDK translates [HandlerError], [OperationError] and [FailureError] to and from [Failure] | ||
| // objects maintaining their cause chain. | ||
| // Arbitrary errors are translated to a [Failure] object with its Message set to the Error() string, losing the cause | ||
| // chain. |
There was a problem hiding this comment.
Might as well mark it as experimental since it's not exposed to Temporal applications yet.
| // chain. | |
| // chain. | |
| // | |
| // NOTE: Experimental |
|
Just please don't merge this until we've validated the changes. |
nexus/failure.go
Outdated
| // The underlying Failure object this error represents. | ||
| Failure Failure | ||
| // An optional nested cause. | ||
| Cause error |
There was a problem hiding this comment.
Failure also has a Cause, do we need two different causes? What scenario would both be set?
There was a problem hiding this comment.
This is the deserialized cause.
nexus/api.go
Outdated
| // construct the cause. | ||
| // OperationFailedErrorf creates an [OperationError] with state set to [OperationStateFailed], using [fmt.Sprintf] to | ||
| // construct the message. | ||
| func OperationFailedErrorf(format string, args ...any) *OperationError { |
There was a problem hiding this comment.
This breaks error chaining no? if args was an error this used to preserve the error chain and now no longer does.
There was a problem hiding this comment.
Same goes for HandlerErrorf
There was a problem hiding this comment.
That was accidentally committed. I meant to revert back to the old implementations. Looks like I missed a couple.
nexus/api.go
Outdated
| // The underlying cause for this error. | ||
| Cause error | ||
| // Set if this error is constructed from a failure object. | ||
| OriginalFailure *Failure |
There was a problem hiding this comment.
I thought we didn't need this anymore since since we are using application failures?
There was a problem hiding this comment.
Still required for the server to rehydrate the original failure.
3d8ad6d to
e5df0cd
Compare
nexus/errors.go
Outdated
| ) | ||
|
|
||
| // An error that directly represents a wire representation of [Failure]. | ||
| // The SDK will convert to this error by default unless the [FailureConverter] instance is customized. |
There was a problem hiding this comment.
[FailureConverter] no longer exists in the Nexus SDK right?
| // OperationFailedErrorf creates an [OperationError] with state set to [OperationStateFailed], using [fmt.Errorf] to | ||
| // construct the cause. | ||
| // | ||
| // Deprecated: Use NewOperationFailedErrorf instead. |
There was a problem hiding this comment.
If we aren't synchronizing the release of the Nexus SDK with the Temporal Go SDK may not want to deprecate these until the Go SDK that supports causless operation errors is released
FailureConverterinterface.HandlerError,OperationError, andFailureErrorto support separateCauseandMessagefields as well asStackTrace.HandlerErrorfin favor ofNewHandlerErrorf.OperationErrorf,OperationCanceledErrorf,OperationFailedErrorf,NewOperationFailedError,NewOperationCanceledErrorin favor ofNewOperationErrorf,NewOperationFailedErrorfandNewOperationCanceledErrorf.Revives the work from #56 and #65