---------------------------------------
(t *testing.T)
| 259 | // --------------------------------------- |
| 260 | |
| 261 | func TestCustomError(t *testing.T) { |
| 262 | dbMsg := "database error 1205 (lock wait time exceeded)" |
| 263 | outerMsg := "outer msg" |
| 264 | |
| 265 | dbError := newDatabaseError(dbMsg, 1205) |
| 266 | outerError := Wrap(dbError, outerMsg) |
| 267 | |
| 268 | errorStr := outerError.Error() |
| 269 | if strings.Index(errorStr, dbMsg) == -1 { |
| 270 | t.Errorf("couldn't find database error message in:\n%s", errorStr) |
| 271 | } |
| 272 | |
| 273 | if strings.Index(errorStr, outerMsg) == -1 { |
| 274 | t.Errorf("couldn't find outer error message in:\n%s", errorStr) |
| 275 | } |
| 276 | |
| 277 | if strings.Index(errorStr, "errors.TestCustomError") == -1 { |
| 278 | t.Errorf("couldn't find this function in stack trace:\n%s", errorStr) |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | type customErr struct { |
| 283 | } |
nothing calls this directly
no test coverage detected