func (rw *ResponseWriter) WriteError(err error) {
	httpErr, ok := err.(*Error)
	if ok {
		rw.WriteText(httpErr.Status(), httpErr.StatusMsg())
		return
	}
	rw.WriteText(http.StatusInternalServerError, StatusServerError)
}
WriteError writes the given error to the response writer
package httpserver
import (
	"net/http"
)
const (
	ContentTypeHeader = "Content-Type"
	ContentTypeJSON = "application/json"
	ContentTypeText = "text/plain"
	ContentTypeBinary = "application/octet-stream"
)
type ResponseWriter struct {
	http.ResponseWriter
}
func NewResponseWriter(rw http.ResponseWriter) *ResponseWriter {
	return &ResponseWriter{
		ResponseWriter: rw,
	}
}
func (rw *ResponseWriter) Write(status int, bytes []byte, contentType string) {
	rw.Header().Set(ContentTypeHeader, contentType)
	rw.WriteHeader(status)
	logger.Debugf("Writing response - Status: %d, Payload: %s", status, bytes)
	if _, err := rw.ResponseWriter.Write(bytes); err != nil {
		logger.Errorf("Unable to write UploadResponse: %s", err)
	}
}
func (rw *ResponseWriter) WriteText(status int, text string) {
	rw.Header().Set(ContentTypeHeader, ContentTypeText)
	rw.WriteHeader(status)
	logger.Debugf("Writing text response - Status: %d, Payload: %s", status, text)
	if _, err := rw.ResponseWriter.Write([]byte(text)); err != nil {
		logger.Errorf("Unable to write response: %s", err)
	}
}