Add timeout errors to json output
This commit is contained in:
parent
220d04b696
commit
0615896c0e
5 changed files with 11 additions and 3 deletions
|
@ -301,7 +301,7 @@ func TestCreate(t *testing.T) {
|
||||||
So(res, ShouldHaveLength, 3)
|
So(res, ShouldHaveLength, 3)
|
||||||
So(res[1].Result, ShouldHaveLength, 0)
|
So(res[1].Result, ShouldHaveLength, 0)
|
||||||
So(res[2].Result, ShouldHaveLength, 0)
|
So(res[2].Result, ShouldHaveLength, 0)
|
||||||
So(res[1].Status, ShouldEqual, "ERR")
|
So(res[1].Status, ShouldEqual, "ERR_TO")
|
||||||
So(res[1].Detail, ShouldEqual, "Query timeout of 1ms exceeded")
|
So(res[1].Detail, ShouldEqual, "Query timeout of 1ms exceeded")
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -149,7 +149,7 @@ func TestDelete(t *testing.T) {
|
||||||
So(res, ShouldHaveLength, 3)
|
So(res, ShouldHaveLength, 3)
|
||||||
So(res[1].Result, ShouldHaveLength, 0)
|
So(res[1].Result, ShouldHaveLength, 0)
|
||||||
So(res[2].Result, ShouldHaveLength, 0)
|
So(res[2].Result, ShouldHaveLength, 0)
|
||||||
So(res[1].Status, ShouldEqual, "ERR")
|
So(res[1].Status, ShouldEqual, "ERR_TO")
|
||||||
So(res[1].Detail, ShouldEqual, "Query timeout of 1ns exceeded")
|
So(res[1].Detail, ShouldEqual, "Query timeout of 1ns exceeded")
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -542,6 +542,8 @@ func status(e error) (s string) {
|
||||||
return "ERR_FD"
|
return "ERR_FD"
|
||||||
case *IndexError:
|
case *IndexError:
|
||||||
return "ERR_IX"
|
return "ERR_IX"
|
||||||
|
case *TimerError:
|
||||||
|
return "ERR_TO"
|
||||||
case error:
|
case error:
|
||||||
return "ERR"
|
return "ERR"
|
||||||
}
|
}
|
||||||
|
|
|
@ -295,7 +295,7 @@ func TestUpdate(t *testing.T) {
|
||||||
So(res, ShouldHaveLength, 3)
|
So(res, ShouldHaveLength, 3)
|
||||||
So(res[1].Result, ShouldHaveLength, 0)
|
So(res[1].Result, ShouldHaveLength, 0)
|
||||||
So(res[2].Result, ShouldHaveLength, 0)
|
So(res[2].Result, ShouldHaveLength, 0)
|
||||||
So(res[1].Status, ShouldEqual, "ERR")
|
So(res[1].Status, ShouldEqual, "ERR_TO")
|
||||||
So(res[1].Detail, ShouldEqual, "Query timeout of 1ms exceeded")
|
So(res[1].Detail, ShouldEqual, "Query timeout of 1ms exceeded")
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -99,6 +99,8 @@ func OutputBase(c *fibre.Context, t string, d Display, m Method, res []*db.Respo
|
||||||
return fibre.NewHTTPError(422, ret.Detail)
|
return fibre.NewHTTPError(422, ret.Detail)
|
||||||
case "ERR_IX":
|
case "ERR_IX":
|
||||||
return fibre.NewHTTPError(422, ret.Detail)
|
return fibre.NewHTTPError(422, ret.Detail)
|
||||||
|
case "ERR_TO":
|
||||||
|
return fibre.NewHTTPError(504, ret.Detail)
|
||||||
default:
|
default:
|
||||||
return fibre.NewHTTPError(400, ret.Detail)
|
return fibre.NewHTTPError(400, ret.Detail)
|
||||||
}
|
}
|
||||||
|
@ -125,6 +127,8 @@ func OutputRest(c *fibre.Context, t string, d Display, m Method, res []*db.Respo
|
||||||
return fibre.NewHTTPError(422, ret.Detail)
|
return fibre.NewHTTPError(422, ret.Detail)
|
||||||
case "ERR_IX":
|
case "ERR_IX":
|
||||||
return fibre.NewHTTPError(422, ret.Detail)
|
return fibre.NewHTTPError(422, ret.Detail)
|
||||||
|
case "ERR_TO":
|
||||||
|
return fibre.NewHTTPError(504, ret.Detail)
|
||||||
default:
|
default:
|
||||||
return fibre.NewHTTPError(400, ret.Detail)
|
return fibre.NewHTTPError(400, ret.Detail)
|
||||||
}
|
}
|
||||||
|
@ -197,6 +201,8 @@ func OutputJson(c *fibre.Context, t string, d Display, m Method, res []*db.Respo
|
||||||
return fibre.NewHTTPError(422, ret.Detail)
|
return fibre.NewHTTPError(422, ret.Detail)
|
||||||
case "ERR_IX":
|
case "ERR_IX":
|
||||||
return fibre.NewHTTPError(422, ret.Detail)
|
return fibre.NewHTTPError(422, ret.Detail)
|
||||||
|
case "ERR_TO":
|
||||||
|
return fibre.NewHTTPError(504, ret.Detail)
|
||||||
default:
|
default:
|
||||||
return fibre.NewHTTPError(400, ret.Detail)
|
return fibre.NewHTTPError(400, ret.Detail)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue