github.com/damirazo/docker@v1.9.0/errors/builder.go (about) 1 package errors 2 3 // This file contains all of the errors that can be generated from the 4 // docker/builder component. 5 6 import ( 7 "net/http" 8 9 "github.com/docker/distribution/registry/api/errcode" 10 ) 11 12 var ( 13 // ErrorCodeAtLeastOneArg is generated when the parser comes across a 14 // Dockerfile command that doesn't have any args. 15 ErrorCodeAtLeastOneArg = errcode.Register(errGroup, errcode.ErrorDescriptor{ 16 Value: "ATLEASTONEARG", 17 Message: "%s requires at least one argument", 18 Description: "The specified command requires at least one argument", 19 HTTPStatusCode: http.StatusInternalServerError, 20 }) 21 22 // ErrorCodeExactlyOneArg is generated when the parser comes across a 23 // Dockerfile command that requires exactly one arg but got less/more. 24 ErrorCodeExactlyOneArg = errcode.Register(errGroup, errcode.ErrorDescriptor{ 25 Value: "EXACTLYONEARG", 26 Message: "%s requires exactly one argument", 27 Description: "The specified command requires exactly one argument", 28 HTTPStatusCode: http.StatusInternalServerError, 29 }) 30 31 // ErrorCodeAtLeastTwoArgs is generated when the parser comes across a 32 // Dockerfile command that requires at least two args but got less. 33 ErrorCodeAtLeastTwoArgs = errcode.Register(errGroup, errcode.ErrorDescriptor{ 34 Value: "ATLEASTTWOARGS", 35 Message: "%s requires at least two arguments", 36 Description: "The specified command requires at least two arguments", 37 HTTPStatusCode: http.StatusInternalServerError, 38 }) 39 40 // ErrorCodeTooManyArgs is generated when the parser comes across a 41 // Dockerfile command that has more args than it should 42 ErrorCodeTooManyArgs = errcode.Register(errGroup, errcode.ErrorDescriptor{ 43 Value: "TOOMANYARGS", 44 Message: "Bad input to %s, too many args", 45 Description: "The specified command was passed too many arguments", 46 HTTPStatusCode: http.StatusInternalServerError, 47 }) 48 49 // ErrorCodeChainOnBuild is generated when the parser comes across a 50 // Dockerfile command that is trying to chain ONBUILD commands. 51 ErrorCodeChainOnBuild = errcode.Register(errGroup, errcode.ErrorDescriptor{ 52 Value: "CHAINONBUILD", 53 Message: "Chaining ONBUILD via `ONBUILD ONBUILD` isn't allowed", 54 Description: "ONBUILD Dockerfile commands aren't allow on ONBUILD commands", 55 HTTPStatusCode: http.StatusInternalServerError, 56 }) 57 58 // ErrorCodeBadOnBuildCmd is generated when the parser comes across a 59 // an ONBUILD Dockerfile command with an invalid trigger/command. 60 ErrorCodeBadOnBuildCmd = errcode.Register(errGroup, errcode.ErrorDescriptor{ 61 Value: "BADONBUILDCMD", 62 Message: "%s isn't allowed as an ONBUILD trigger", 63 Description: "The specified ONBUILD command isn't allowed", 64 HTTPStatusCode: http.StatusInternalServerError, 65 }) 66 67 // ErrorCodeMissingFrom is generated when the Dockerfile is missing 68 // a FROM command. 69 ErrorCodeMissingFrom = errcode.Register(errGroup, errcode.ErrorDescriptor{ 70 Value: "MISSINGFROM", 71 Message: "Please provide a source image with `from` prior to run", 72 Description: "The Dockerfile is missing a FROM command", 73 HTTPStatusCode: http.StatusInternalServerError, 74 }) 75 76 // ErrorCodeNotOnWindows is generated when the specified Dockerfile 77 // command is not supported on Windows. 78 ErrorCodeNotOnWindows = errcode.Register(errGroup, errcode.ErrorDescriptor{ 79 Value: "NOTONWINDOWS", 80 Message: "%s is not supported on Windows", 81 Description: "The specified Dockerfile command is not supported on Windows", 82 HTTPStatusCode: http.StatusInternalServerError, 83 }) 84 85 // ErrorCodeVolumeEmpty is generated when the specified Volume string 86 // is empty. 87 ErrorCodeVolumeEmpty = errcode.Register(errGroup, errcode.ErrorDescriptor{ 88 Value: "VOLUMEEMPTY", 89 Message: "Volume specified can not be an empty string", 90 Description: "The specified volume can not be an empty string", 91 HTTPStatusCode: http.StatusInternalServerError, 92 }) 93 )