Documentation
¶
Overview ¶
Constants, errors and globals variables used across the module.
Index ¶
Constants ¶
View Source
const ( ShebangPrefix = "#//!" ShebangLen = len(ShebangPrefix) ShortestSupportedScriptTagLen = 2 LongestSupportedScriptTagLen = 2 JOMVariableName = "json" KeyValuePairDelim = ':' HaltingDelayUnits = time.Second ScriptErrorFormatString = "script <%s>:\n```\n%s\n```" AnonymousScriptPath = "<anonymous>" CurrentNodeLiteralVarName = "__currentNodeLiteral__" CurrentNodeValueVarName = "__currentNode__" ModifiedTrailValueVarName = "__modifiedTrail__" )
Variables ¶
View Source
var ( ParseErr = CliError{1, true, "Parse error has occurred"} FormatErr = CliError{2, true, "Format error has occurred"} ReadFileErr = CliError{3, true, "A read file error occurred"} SubcommandErr = CliError{5, false, "Subcommand not given/not recognised"} RequiredFlagErr = CliError{6, false, "The following required flag was not given"} FileDoesNotExistErr = CliError{7, false, "The following file does not exist and cannot be read"} MarshalErr = CliError{8, false, "The following JsonMap cannot be marshalled for the following reasons"} UnmarshalErr = CliError{9, false, "The following data cannot be unmarshalled for the following reasons"} EvaluationErr = CliError{10, false, "EVAL ERROR"} MarkupErr = CliError{11, false, "MARKUP ERROR"} )
CliError(s) (positive codes).
View Source
var ( HaltingProblem = RuntimeError{-1, "Infinite loop has occurred after"} UnsupportedScriptLang = RuntimeError{-2, "Unsupported script language in shebang"} BuiltinGetterError = RuntimeError{-3, "An error has occurred when getting the value of a builtin variable"} OverriddenBuiltin = RuntimeError{-4, "The following builtin was overridden"} ScriptError = RuntimeError{-5, "The following script has caused an error"} JsonPathError = RuntimeError{-6, "A JSON path could not be evaluated for the following reason(s)"} )
RuntimeError(s) (negative codes).
View Source
var (
// The delay time in HaltingDelayUnits after which a running script will panic to stop execution of infinitely executing scripts.
HaltingDelay = 4
)
These are global variables that can be changed.
Functions ¶
func CliSubcommandDescriptions ¶
Returns a map of the descriptions for the subcommands that are used in the CLI application.
Types ¶
type CliError ¶
type CliError struct {
// contains filtered or unexported fields
}
CliError type for handling errors which occur in the CLI.
type RuntimeError ¶
type RuntimeError struct {
// contains filtered or unexported fields
}
For handling errors that occur at runtime.
func (*RuntimeError) FillError ¶
func (e *RuntimeError) FillError(extraInfo ...string) error
Fill out a RuntimeError error with the given extra info.
func (*RuntimeError) FillFromErrors ¶
func (e *RuntimeError) FillFromErrors(errs []error) error
Fill out a RuntimeError error with the given list of errors.
For all errors with the same code and message the code and message will be removed from that error before being appended to the returned error. This stops situations where you have:
(-6) A JSON path could not be evaluated for the following reasons: ..., (-6) A JSON path could not be evaluated for the following reasons: ...
Click to show internal directories.
Click to hide internal directories.