|
|
@ -1,6 +1,7 @@
|
|
|
|
package main
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
|
|
|
|
"context"
|
|
|
|
"encoding/json"
|
|
|
|
"encoding/json"
|
|
|
|
"errors"
|
|
|
|
"errors"
|
|
|
|
"flag"
|
|
|
|
"flag"
|
|
|
@ -197,6 +198,8 @@ func writeError(w http.ResponseWriter, err error) {
|
|
|
|
w.WriteHeader(http.StatusBadRequest)
|
|
|
|
w.WriteHeader(http.StatusBadRequest)
|
|
|
|
case errors.Is(err, noxy.ErrNotFound):
|
|
|
|
case errors.Is(err, noxy.ErrNotFound):
|
|
|
|
w.WriteHeader(http.StatusNotFound)
|
|
|
|
w.WriteHeader(http.StatusNotFound)
|
|
|
|
|
|
|
|
case errors.Is(err, context.DeadlineExceeded) || errors.Is(err, context.Canceled):
|
|
|
|
|
|
|
|
w.WriteHeader(http.StatusServiceUnavailable)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fmt.Fprint(w, err.Error())
|
|
|
|
fmt.Fprint(w, err.Error())
|
|
|
|
}
|
|
|
|
}
|
|
|
|