Browse Source

Remove hardcoded error

Signed-off-by: Antonio Murdaca <me@runcom.ninja>
Antonio Murdaca 10 years ago
parent
commit
8b02d85e17
2 changed files with 2 additions and 7 deletions
  1. 1 6
      builder/evaluator.go
  2. 1 1
      integration-cli/docker_cli_build_test.go

+ 1 - 6
builder/evaluator.go

@@ -20,7 +20,6 @@
 package builder
 
 import (
-	"errors"
 	"fmt"
 	"io"
 	"os"
@@ -42,10 +41,6 @@ import (
 	"github.com/docker/docker/utils"
 )
 
-var (
-	ErrDockerfileEmpty = errors.New("Dockerfile cannot be empty")
-)
-
 // Environment variable interpolation will happen on these statements only.
 var replaceEnvAllowed = map[string]struct{}{
 	command.Env:     {},
@@ -225,7 +220,7 @@ func (b *Builder) readDockerfile() error {
 		return fmt.Errorf("Cannot locate specified Dockerfile: %s", origFile)
 	}
 	if fi.Size() == 0 {
-		return ErrDockerfileEmpty
+		return fmt.Errorf("The Dockerfile (%s) cannot be empty", origFile)
 	}
 
 	f, err := os.Open(filename)

+ 1 - 1
integration-cli/docker_cli_build_test.go

@@ -3504,7 +3504,7 @@ func TestBuildFailsDockerfileEmpty(t *testing.T) {
 	defer deleteImages(name)
 	_, err := buildImage(name, ``, true)
 	if err != nil {
-		if !strings.Contains(err.Error(), "Dockerfile cannot be empty") {
+		if !strings.Contains(err.Error(), "The Dockerfile (Dockerfile) cannot be empty") {
 			t.Fatalf("Wrong error %v, must be about empty Dockerfile", err)
 		}
 	} else {