13 lines
307 B
Go
13 lines
307 B
Go
|
package measurex
|
||
|
|
||
|
// NewFailure creates a serializable failure from an error. We
|
||
|
// cannot round trip an error using JSON, so we serialize to this
|
||
|
// intermediate format that is a sort of Optional<string>.
|
||
|
func NewFailure(err error) *string {
|
||
|
if err == nil {
|
||
|
return nil
|
||
|
}
|
||
|
s := err.Error()
|
||
|
return &s
|
||
|
}
|