Skip to content

Commit

Permalink
Update error-handling.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Vardan2009 committed Jun 1, 2024
1 parent 58e8285 commit d8883a6
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions docs/error-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,33 +79,23 @@ error message.

## Example

```js linenums="1" title="arg-error.rn"
fun FunctionError(func, base_err) -> "Something went wrong in " + func + ": " + base_err

fun risky_operation(y)
{
try
{
x = 10 / y
}
catch as e
{
raise FunctionError("risky_operation", e)
}
```js linenums="1" title="custom-error.rn"
fun CustomError(file) {
return "Something went wrong in " + file
}

risky_operation(0)
raise CustomError("custom-error.rn")
```

**Output:**

```py
Radiation (most recent call last):
File <stdin>, line 10
FunctionError: Something went wrong in risky_operation: Division by zero
FunctionError: Something went wrong in risky_operation

raise FunctionError("risky_operation", e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
raise FunctionError("risky_operation")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

```

Expand Down

0 comments on commit d8883a6

Please sign in to comment.