Skip to content

Commit 929732a

Browse files
committed
Keyword Updates
-rename from unsafe/safe to try/catch
1 parent 19f0c65 commit 929732a

File tree

5 files changed

+43
-33
lines changed

5 files changed

+43
-33
lines changed

docs/index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ title: "Documentation"
1717
- [`func`](/docs/keywords/func)
1818
- [`walk`](/docs/keywords/walk)
1919
- [`while`](/docs/keywords/while)
20-
- [`unsafe`](/docs/keywords/unsafe)
21-
- [`safe`](/docs/keywords/safe)
20+
- [`try`](/docs/keywords/try)
21+
- [`catch`](/docs/keywords/catch)
2222
- [`fetch`](/docs/keywords/fetch)
2323
- [`give`](/docs/keywords/give)
2424
- [`next`](/docs/keywords/next)

docs/keywords/catch.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
title: "catch"
3+
---
4+
5+
# Keyword: `catch`
6+
7+
Represents the safe block of code to execute after a `try` block fails. _Used in chain with the [`try` keyword](/docs/keywords/try)._
8+
9+
```
10+
try {
11+
# ...
12+
} safe error {
13+
bark("Some error occured: " + error);
14+
}
15+
```
16+
17+
`safe` takes an `<indentifier>` as the error output, where `<indentifier>` is a string type with the encountered error inside.
18+
19+
```
20+
try {
21+
1 / 0;
22+
} catch division_error {
23+
bark(division_error); # output: division by 0
24+
}
25+
```

docs/keywords/safe.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

docs/keywords/try.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
title: "try"
3+
---
4+
5+
# Keyword: `try`
6+
7+
Represents the unsafe block of code to execute. _Used in chain with the [`catch` keyword](/docs/keywords/catch)_.
8+
9+
```
10+
try {
11+
# dangerous code
12+
1 / 0
13+
} catch _ {
14+
# ...
15+
}
16+
```

docs/keywords/unsafe.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)