21031: Fixes post installation script for rails applications.
[arvados.git] / sdk / go / httpserver / error.go
index f1817d3374ae11e07f4479de77b1b1b67e4b3cf9..7a4233d6c6beec1d5ca912bf61a060d3b17756e5 100644 (file)
@@ -6,9 +6,19 @@ package httpserver
 
 import (
        "encoding/json"
+       "fmt"
        "net/http"
 )
 
+type HTTPStatusError interface {
+       error
+       HTTPStatus() int
+}
+
+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}
 }