Suggestion to improve error matching

Hello,

Error matching on ApplicationErrors can be a pain, especially when error wrapping with errors.Join or fmt.Errorf is involved. For example, ApplicationError doesn’t implement Unwrap() with []error interface, so errors.Join will result in the error chain being lost.

In Error unwrapping I read that you considered adding support for registering user’s own errors:

We decided not to follow with the same approach for errors (registering every possible error type is overkill).

I agree that registering every possible error is overkill, but what about registering one user error, that satisfies a defined interface? If Temporal returns that error instead of ApplicationError, the user has control over implementations of As/Is methods and can implement own logic for error matching. They could also add custom fields, which is arguably better than using a string based dictionary.