Error
Background
Section titled “Background”Given a file named “pen.json” with:
{ "type": "library", "dependencies": {}}Call an error function
Section titled “Call an error function”Given a file named “Foo.pen” with:
f = \() error { error(none)}When I run pen build
Then the exit status should be 0.
Call a source function
Section titled “Call a source function”Given a file named “Foo.pen” with:
f = \(e error) any { source(e)}When I run pen build
Then the exit status should be 0.
Use a try operator
Section titled “Use a try operator”Given a file named “Foo.pen” with:
f = \(x number | error) number | error { x? + 1}When I run pen build
Then the exit status should be 0.
Use a try operator with a union type
Section titled “Use a try operator with a union type”Given a file named “Foo.pen” with:
f = \(x number | none | error) number | error { if x = x? as number { x + 1 } else if none { 0 }}When I run pen build
Then the exit status should be 0.