add the error message to DatabaseError (#846)

This commit is contained in:
Victor Vrantchan 2017-01-10 11:01:47 -05:00 committed by GitHub
parent ee3940e163
commit 48ca30bffc
2 changed files with 2 additions and 2 deletions

View file

@ -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

View file

@ -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)