mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
add the error message to DatabaseError (#846)
This commit is contained in:
parent
ee3940e163
commit
48ca30bffc
2 changed files with 2 additions and 2 deletions
|
|
@ -55,7 +55,7 @@ func NewFromError(err error, status int, publicMessage string) *KolideError {
|
|||
|
||||
// Wrap a DB error with the extra KolideError decorations
|
||||
func DatabaseError(err error) *KolideError {
|
||||
return NewFromError(err, http.StatusInternalServerError, "Database error")
|
||||
return NewFromError(err, http.StatusInternalServerError, "Database error: "+err.Error())
|
||||
}
|
||||
|
||||
// Wrap a server error with the extra KolideError decorations
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ func TestDatabaseError(t *testing.T) {
|
|||
expect := &KolideError{
|
||||
Err: err,
|
||||
StatusCode: http.StatusInternalServerError,
|
||||
PublicMessage: "Database error",
|
||||
PublicMessage: "Database error: " + err.Error(),
|
||||
PrivateMessage: "Foo error",
|
||||
}
|
||||
assert.Equal(t, expect, kolideErr)
|
||||
|
|
|
|||
Loading…
Reference in a new issue