mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-03 14:40:02 +01:00
* chore(deps): update submodule goutils * docs(http): remove default client from README.md * refactor(rules): introduce block DSL, phase-based execution, and flow validation - add block syntax parser/scanner with nested @blocks and elif/else support - restructure rule execution into explicit pre/post phases with phase flags - classify commands by phase and termination behavior - enforce flow semantics (default rule handling, dead-rule detection) - expand HTTP flow coverage with block + YAML parity tests and benches - refresh rules README/spec and update playground/docs integration - Default rules act as fallback handlers that execute only when no matching non-default rule exists in the pre phase - IfElseBlockCommand now returns early when a condition matches with a nil Do block, instead of falling through to else blocks - Add nil check for auth handler to allow requests when no auth is configured * fix(rules): buffer log output before writing to stdout/stderr * refactor(api/rules): remove IsResponseRule field from ParsedRule and related logic * docs(rules): update examples to use block syntax
37 lines
1.6 KiB
Go
37 lines
1.6 KiB
Go
package rules
|
|
|
|
import (
|
|
gperr "github.com/yusing/goutils/errs"
|
|
)
|
|
|
|
var (
|
|
ErrUnterminatedQuotes = gperr.New("unterminated quotes")
|
|
ErrUnterminatedBrackets = gperr.New("unterminated brackets")
|
|
ErrUnterminatedParenthesis = gperr.New("unterminated parenthesis")
|
|
ErrUnterminatedEnvVar = gperr.New("unterminated env var")
|
|
ErrUnknownDirective = gperr.New("unknown directive")
|
|
ErrUnknownModField = gperr.New("unknown field")
|
|
ErrEnvVarNotFound = gperr.New("env variable not found")
|
|
ErrInvalidArguments = gperr.New("invalid arguments")
|
|
ErrInvalidOnTarget = gperr.New("invalid `rule.on` target")
|
|
|
|
ErrMultipleDefaultRules = gperr.New("multiple default rules")
|
|
ErrDeadRule = gperr.New("dead rule")
|
|
|
|
// vars errors
|
|
ErrNoArgProvided = gperr.New("no argument provided")
|
|
ErrUnexpectedVar = gperr.New("unexpected variable")
|
|
ErrUnexpectedQuote = gperr.New("unexpected quote")
|
|
|
|
ErrExpectNoArg = gperr.Wrap(ErrInvalidArguments, "expect no arg")
|
|
ErrExpectOneArg = gperr.Wrap(ErrInvalidArguments, "expect 1 arg")
|
|
ErrExpectOneOrTwoArgs = gperr.Wrap(ErrInvalidArguments, "expect 1 or 2 args")
|
|
ErrExpectTwoArgs = gperr.Wrap(ErrInvalidArguments, "expect 2 args")
|
|
ErrExpectTwoOrThreeArgs = gperr.Wrap(ErrInvalidArguments, "expect 2 or 3 args")
|
|
ErrExpectThreeArgs = gperr.Wrap(ErrInvalidArguments, "expect 3 args")
|
|
ErrExpectFourArgs = gperr.Wrap(ErrInvalidArguments, "expect 4 args")
|
|
ErrExpectKVOptionalV = gperr.Wrap(ErrInvalidArguments, "expect 'key' or 'key value'")
|
|
|
|
ErrInvalidBlockSyntax = gperr.New("invalid block syntax") // TODO: struct this error
|
|
)
|