pub enum ConfigError {
Show 17 variants
SyntaxError(RecognizerError),
NotLoaded,
MappingExpected,
StringExpected(Location),
DuplicateKey(String, Location, Location),
BadFilePath(String),
FileNotFound(String),
FileReadFailed(String),
NoContext,
UnknownVariable(String, Location),
NotPresent(String, Option<Location>),
InvalidPath(RecognizerError),
InvalidPathOperand(Location),
IndexOutOfRange(i64, Location),
EvaluationFailed(Location),
ConversionError(String),
CircularReferenceError(Vec<(String, Location)>),
}
Expand description
This is the type of error returned from the high-level API for CFG configurations.
Variants§
SyntaxError(RecognizerError)
This error is returned if the configuration text couldn’t be parsed as valid CFG source. The underlying parser error is returned, which should contain location information.
NotLoaded
This error is returned if an attempt is made to query a configuration into which nothing has been loaded.
MappingExpected
This error is returned if a file loaded as a top-level configuration is not a mapping or mapping body.
StringExpected(Location)
This error is returned if a string was expected, but not found. The location where it was expected is returned. This might be the location of an @ operator, whose operand must be a string be cause it represents the path to a file to be included as a sub-configuration.
DuplicateKey(String, Location, Location)
This error is returned if a duplicate key is found when parsing a configuration. The key, the duplicate location and the original location are returned.
BadFilePath(String)
This error is returned if a specified path is invalid (e.g. couldn’t be canonocalized). The offending path is provided.
FileNotFound(String)
This error is returned if a file couldn’t be found. The path that couldn’t be found is provided.
FileReadFailed(String)
This error is returned if a file couldn’t be opened for reading. The path that couldn’t be read is provided.
NoContext
This error is returned if an identifier is seen, but no lookup context has been provided.
UnknownVariable(String, Location)
This error is returned if an identifier is not a key in a specified lookup context.
NotPresent(String, Option<Location>)
This error is returned if a key is not present in a configuration or path therein. If the absence is in a path, the location within that path is returned, along with the missing key.
InvalidPath(RecognizerError)
This error is returned if a string couldn’t be parsed as a valid path. The underlying parser error is returned, which will include location information.
InvalidPathOperand(Location)
This error is returned if a path operand isn’t valid for the current container (e.g. string index for a list, or numeric index for a mapping). The source location where the error occurred are returned.
IndexOutOfRange(i64, Location)
This error is returned if an index value is out of range. The bad index value and the source location where it was found are returned.
EvaluationFailed(Location)
This error is returned if an evaluation failed. A source location near to where the failure occurred is returned.
ConversionError(String)
This error is returned if a special string (back-tick string) couldn’t be converted. The special string which couldn’t be handled is returned.
CircularReferenceError(Vec<(String, Location)>)
This error is returned if a reference cycle is detected. A list of the reference paths in the cycle, together with their locations, is returned.