+func Errorf(status int, tmpl string, args ...interface{}) error {
+ return errorWithStatus{fmt.Errorf(tmpl, args...), status}
+}
+
+func ErrorWithStatus(err error, status int) error {
+ return errorWithStatus{err, status}
+}
+
+type errorWithStatus struct {
+ error
+ Status int
+}
+
+func (ews errorWithStatus) HTTPStatus() int {
+ return ews.Status
+}
+