Skip to content

Commit

Permalink
feat(docs): add fallibility examples (#18931)
Browse files Browse the repository at this point in the history
  • Loading branch information
pront authored Oct 25, 2023
1 parent 00c40d7 commit 08b45a5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions website/cue/reference/remap/expressions/function_call.cue
Original file line number Diff line number Diff line change
Expand Up @@ -167,5 +167,21 @@ remap: expressions: function_call: {
"""#
return: ["hello", "world!"]
},
{
title: "Infallible function invocation"
source: #"""
split("apples and pears and bananas", " and ")
"""#
return: ["apples", "pears", "bananas"]
},
{
title: "Fallible function invocation"
input: log: message: "apples and pears and bananas"
source: #"""
# The compiler cannot determine the argument type thus we need to do error handling.
split!(.message, " and ")
"""#
return: ["apples", "pears", "bananas"]
},
]
}

0 comments on commit 08b45a5

Please sign in to comment.