()
| 35 | } |
| 36 | |
| 37 | func ExampleError_StatusCode() { |
| 38 | err := errors.New("my stuff is missing") |
| 39 | unifiedError := unierr.Wrap(err, codes.NotFound) |
| 40 | |
| 41 | httpStatus := unifiedError.StatusCode() |
| 42 | fmt.Println(httpStatus) |
| 43 | bytes, _ := unifiedError.MarshalJSON() |
| 44 | fmt.Println(string(bytes)) |
| 45 | // Output: |
| 46 | // 404 |
| 47 | // {"code":5,"message":"my stuff is missing"} |
| 48 | } |
| 49 | |
| 50 | func ExampleError_GRPCStatus() { |
| 51 | err := errors.New("my stuff is missing") |
nothing calls this directly
no test coverage detected