From d85c1a258aeeaf50145ee4d13df631ea019b0c68 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Mon, 5 Jan 2026 13:51:59 +0100 Subject: [PATCH] daemon/server/httputils: remove badParameterError The "param" field was only used to generate the error-message, and the produced error-message was missing a space so we may as well just inline it. Signed-off-by: Sebastiaan van Stijn --- daemon/server/httputils/form.go | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/daemon/server/httputils/form.go b/daemon/server/httputils/form.go index e075762893..1abd3e62b2 100644 --- a/daemon/server/httputils/form.go +++ b/daemon/server/httputils/form.go @@ -114,16 +114,6 @@ type ArchiveOptions struct { Path string } -type badParameterError struct { - param string -} - -func (e badParameterError) Error() string { - return "bad parameter: " + e.param + "cannot be empty" -} - -func (e badParameterError) InvalidParameter() {} - // ArchiveFormValues parses form values and turns them into ArchiveOptions. // It fails if the archive name and path are not in the request. func ArchiveFormValues(r *http.Request, vars map[string]string) (ArchiveOptions, error) { @@ -133,11 +123,11 @@ func ArchiveFormValues(r *http.Request, vars map[string]string) (ArchiveOptions, name := vars["name"] if name == "" { - return ArchiveOptions{}, badParameterError{"name"} + return ArchiveOptions{}, errdefs.InvalidParameter(errors.New("bad parameter: name cannot be empty")) } path := r.Form.Get("path") if path == "" { - return ArchiveOptions{}, badParameterError{"path"} + return ArchiveOptions{}, errdefs.InvalidParameter(errors.New("bad parameter: path cannot be empty")) } return ArchiveOptions{name, path}, nil }