Skip to content

Commit

Permalink
feat()
Browse files Browse the repository at this point in the history
  • Loading branch information
emil14 committed Feb 9, 2025
1 parent f51883a commit 2f793ef
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"request": "launch",
"mode": "auto",
"program": "${workspaceFolder}/cmd/neva",
"cwd": "${workspaceFolder}/e2e/errors_lift",
"cwd": "${workspaceFolder}/e2e/for_with_range_and_if",
"args": ["run", "--trace", "main"]
},
{
Expand Down
2 changes: 1 addition & 1 deletion e2e/errors_lift/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func Test(t *testing.T) {
require.NoError(t, err)
require.Equal(
t,
"Friday\n",
"42\n",
string(out),
)

Expand Down
20 changes: 13 additions & 7 deletions e2e/errors_lift/main/main.neva
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import { fmt, errors }
import {
fmt
errors
}

// errors.Lift wraps handler so it behaves like a node with error outport.
def Main(start any) (stop any) {
lifted errors.Lift<any, any>{Handler}
lift errors.Lift<any, any>{Handler}
panic Panic
---
:start -> lifted
lifted:res -> :stop
lifted:err -> panic
:start -> lift
lift:res -> :stop
lift:err -> panic
}

// Handler doesn't have an error outport, because it doesn't do anything.
// Handler doesn't have error outport.
def Handler(data any) (res any) {
:data -> :res
println fmt.Println<any>
---
:data -> '42' -> println -> :res
}

0 comments on commit 2f793ef

Please sign in to comment.