MergeErrors updates an error by merging another into it. It first converts other into a ServiceError if not already one - producing an internal error in that case. The merge algorithm is:

* If any of e or other is an internal error then the result is an internal error

* If the status or code of e and other don't match then the result is a 400 "bad_request"

The Detail field is updated by concatenating the Detail fields of e and other separated by a semi-colon. The MetaValues field of is updated by merging the map of other MetaValues into e's where values in e with identical keys to values in other get overwritten.

Merge returns the updated error. This is useful in case the error was initially nil in which case other is returned.

MergeErrors is referenced in 12 repositories