pub enum Error {
Show 14 variants
BadPattern,
Collate,
CharClass,
TrailingBackslash,
BackRef,
Unsupported,
MissingBracket,
MissingParen,
MissingBrace,
BadBrace,
BadRange,
Space,
BadRepeat,
BadMax,
}Expand description
Why a pattern would not compile.
The names and the messages are TRE’s, from deps/tre/lib/regerror.c,
because Redis puts the message straight into its error reply and a client
that matches on the text should not be able to tell the two servers apart.
Variants§
BadPattern
REG_BADPAT, a pattern that is not one.
Collate
REG_ECOLLATE, a [. or [= bracket item.
CharClass
REG_ECTYPE, a [:name:] that is not a class.
TrailingBackslash
REG_EESCAPE, a backslash at the very end.
BackRef
REG_ESUBREG, a backreference to a group the pattern does not have.
Unsupported
A backreference to a group that does exist.
Not one of TRE’s codes. TRE compiles this and Redis refuses it a step later with a sentence of its own, so the message here is that sentence and a caller reporting it should not put “invalid regular expression” in front of it the way it would for the rest of these.
MissingBracket
REG_EBRACK, a bracket expression with no ].
MissingParen
REG_EPAREN, a group with no ).
MissingBrace
REG_EBRACE, a \x{ or a { with no }.
BadBrace
REG_BADBR, a {} whose contents are not a bound.
BadRange
REG_ERANGE, a bracket range that runs backwards.
Space
REG_ESPACE, a pattern that compiles to more than this engine will hold.
BadRepeat
REG_BADRPT, a repetition operator with nothing in front of it.
BadMax
REG_BADMAX, a {n,m} past DUP_MAX.