()
| 50 | } |
| 51 | |
| 52 | func ExampleXError_StackTrace() { |
| 53 | err := New("error") |
| 54 | |
| 55 | stacks := err.Stacks() |
| 56 | |
| 57 | fmt.Println(stacks[0].Func) |
| 58 | fmt.Println(stacks[0].Line) |
| 59 | |
| 60 | containFile := strings.Contains(stacks[0].File, "xerror_example_test.go") |
| 61 | fmt.Println(containFile) |
| 62 | |
| 63 | // Output: |
| 64 | // github.com/duke-git/lancet/v2/xerror.ExampleXError_StackTrace |
| 65 | // 53 |
| 66 | // true |
| 67 | } |
| 68 | |
| 69 | func ExampleXError_With() { |
| 70 | err := New("error").With("level", "high") |