add the error message to DatabaseError (#846)
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user