gopkg.in/simversity/gottp.v3@v3.0.0-20160401065405-576cf030ca0e/errors.go (about) 1 package gottp 2 3 import ( 4 "net/http" 5 6 utils "gopkg.in/simversity/gottp.v3/utils" 7 ) 8 9 type HttpError struct { 10 Status int 11 Message string 12 } 13 14 func (e HttpError) SendOverWire() utils.Q { 15 if e.Status == 0 { 16 e.Status = http.StatusInternalServerError 17 } 18 19 if len(e.Message) == 0 { 20 e.Message = ERROR 21 } 22 23 return utils.Q{ 24 "data": nil, 25 "status": e.Status, 26 "message": e.Message, 27 } 28 }