main.aug
Function and constructor middleware · Source and specification
Files in this project
Code
// aug-spec: "main.aug.md" explains this file. Read it before changes; refresh with aug spec.
import Console and SystemConsole from august.io
implement Console with SystemConsole
import Logger from logging
import ConsoleLogger from logging
import Greeter from app
import describe from app
import ValidationError from interceptors
implement Logger with ConsoleLogger
try:
print(value=describe(label="value", x=6))
catch ValidationError error:
print(value="rejected")
greeter = Greeter(name="AugScript")
print(value=greeter.greet())
try:
describe(x=-1, label="invalid")
catch ValidationError error:
print(value="rejected")// aug-spec: "main.aug.md" explains this file. Read it before changes; refresh with aug spec.
import Console and SystemConsole from august.io
implement Console with SystemConsole
import Logger from logging
import ConsoleLogger from logging
import Greeter from app
import describe from app
import ValidationError from interceptors
implement Logger with ConsoleLogger
try {
print(value=describe(label="value", x=6))
}
catch ValidationError error {
print(value="rejected")
}
greeter = Greeter(name="AugScript")
print(value=greeter.greet())
try {
describe(x=-1, label="invalid")
}
catch ValidationError error {
print(value="rejected")
}Compiled specification
Providers
Console is provided by SystemConsole. The same instance is shared. Logger is provided by ConsoleLogger. The same instance is shared.
Startup
It prints describe with label "value" and x 6 using injected Logger for logger and Console for console. If this work raises ValidationError, it prints "rejected". It sets greeter to a Greeter with name "AugScript" using injected Logger for _logger. It prints greeter.greet using injected Logger for logger and Console for console. source
It tries to call describe with x -1 and label "invalid" using injected Logger for logger and Console for console. If this work raises ValidationError, it prints "rejected". source
Dependencies
It uses SystemConsole from august.io. It uses Greeter (greet) and describe from app. It uses ValidationError from interceptors. It uses ConsoleLogger from logging.
Built-in operations follow the language reference.