interceptors.aug diagrams
Function and constructor middleware
Project overview · Compiled explanation
Class interactions
Mermaid source
flowchart TD
n0["Console"]
n1["Audit"]
n2["Logger"]
n1 -->|"depends on"| n0
n1 -->|"calls log"| n2
Sequences
Call arrows identify checked targets; loop and branch frames determine when they run. Open that target’s module to follow its implementation. Branches describe alternatives; loops describe repeated work. Native calls and interface dispatch stop at their declared contracts. Exit notes end that path; enclosing recovery and cleanup remain visible.
ValidationError constructor
Raised when a numeric input fails validation. It implements Error.
It takes message as a string, kept read-only.
Receive fields: message. Explanation.
Audit.around
Wrap a call without changing its result.
It gets console (Console) from dependency injection.
It can call Console.write.
Mermaid source
sequenceDiagram
participant p0 as Audit.around
participant p1 as logger: Logger
participant p2 as next
p0->>p1: log(message=”before”) · interface dispatch
p0->>p2: next() · conditional interceptor delegation
p2-->>p0: result: string
p0->>p1: log(message=”after”) · interface dispatch
Note over p0: Return result; required cleanup runs before exit
Positive.around
It takes y as an integer.
Failures can raise ValidationError (when the selected value is negative).
Mermaid source
sequenceDiagram
participant p0 as Positive.around
participant p1 as next
alt y is negative
p0->>p0: ValidationError(message=”value must be nonnegative”) ·<br/>construct value
p0-->>p0: ValidationError result: ValidationError
Note over p0: Raise checked failure ValidationError(message=”value<br/>must be nonnegative”); required cleanup runs before exit
end
p0->>p1: next() · conditional interceptor delegation
p1-->>p0: next result: string
Note over p0: Return next(); required cleanup runs before exit
Note over p0: May leave with checked errors: ValidationError
AddOne.around
It takes y as an integer.
Mermaid source
sequenceDiagram
participant p0 as AddOne.around
participant p1 as next
p0->>p1: next(y=y + 1) · conditional interceptor delegation
p1-->>p0: next result: string
Note over p0: Return next(y=y + 1); required cleanup runs before exit
Called contracts
- Console — august/io/contracts.aug
- ValidationError — interceptors.aug
- Logger.log — logging.aug