Skip to content

Commit 27e2a40

Browse files
committed
Document the deprecation of @raises over @throws
Following the changes introduced by rescript-lang/rescript#7932
1 parent 59cf27c commit 27e2a40

File tree

4 files changed

+38
-2
lines changed

4 files changed

+38
-2
lines changed

misc_docs/syntax/decorator_does_not_raise.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ keywords: ["doesNotRaise", "decorator"]
44
name: "@doesNotRaise"
55
summary: "This is the `@doesNotRaise` decorator."
66
category: "decorators"
7+
status: "deprecated"
78
---
89

10+
> Deprecated since v12.0.0. Use the [@doesNotThrow](https://rescript-lang.org/syntax-lookup#does-not-throw-decorator) decorator instead.
11+
912
> This decorator requires [`reanalyze`](https://github.com/rescript-lang/reanalyze), a code analysis tool for ReScript, to be installed. [Click here to read about how you get started with reanalyze.](https://github.com/rescript-lang/reanalyze).
1013
11-
`@doesNotRaise` is used to override the reanalyze's exception analysis and state that an expression does not raise any exceptions, even though the analysis reports otherwise. This can happen for example in the case of array access where the analysis does not perform range checks but takes a conservative stance that any access could potentially raise.
14+
`@doesNotRaise` is used to override the reanalyze's exception analysis and state that an expression does not throw any exceptions, even though the analysis reports otherwise. This can happen for example in the case of array access where the analysis does not perform range checks but takes a conservative stance that any access could potentially throw.
1215

1316
### References
1417

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
id: "does-not-throw-decorator"
3+
keywords: ["doesNotThrow", "decorator"]
4+
name: "@doesNotThrow"
5+
summary: "This is the `@doesNotThrow` decorator."
6+
category: "decorators"
7+
---
8+
9+
> This decorator requires [`reanalyze`](https://github.com/rescript-lang/reanalyze), a code analysis tool for ReScript, to be installed. [Click here to read about how you get started with reanalyze.](https://github.com/rescript-lang/reanalyze).
10+
11+
`@doesNotThrow` is used to override the reanalyze's exception analysis and state that an expression does not throw any exceptions, even though the analysis reports otherwise. This can happen for example in the case of array access where the analysis does not perform range checks but takes a conservative stance that any access could potentially throw.
12+
13+
### References
14+
15+
- [Reanalyze: Exception Analysis](https://github.com/rescript-lang/reanalyze/blob/master/EXCEPTION.md)

misc_docs/syntax/decorator_raises.mdx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ keywords: ["raises", "decorator"]
44
name: "@raises"
55
summary: "This is the `@raises` decorator."
66
category: "decorators"
7+
status: "deprecated"
78
---
89

10+
> Deprecated since v12.0.0. Use the [@throws](https://rescript-lang.org/syntax-lookup#throws-decorator) decorator instead.
11+
912
> This decorator requires [`reanalyze`](https://github.com/rescript-lang/reanalyze), a code analysis tool for ReScript, to be installed. [Click here to read about how you get started with reanalyze.](https://github.com/rescript-lang/reanalyze).
1013
11-
`@raises` is picked up by reanalyze's exception analysis, and acknowledges that a function can raise exceptions that are not caught, and suppresses a warning in that case. Callers of the functions are then subjected to the same rule. Example `@raises(Exn)` or `@raises([E1, E2, E3])` for multiple exceptions.
14+
`@raises` is picked up by reanalyze's exception analysis, and acknowledges that a function can throw exceptions that are not caught, and suppresses a warning in that case. Callers of the functions are then subjected to the same rule. Example `@raises(Exn)` or `@raises([E1, E2, E3])` for multiple exceptions.
1215

1316
### References
1417

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
id: "throws-decorator"
3+
keywords: ["throws", "decorator"]
4+
name: "@throws"
5+
summary: "This is the `@throws` decorator."
6+
category: "decorators"
7+
---
8+
9+
> This decorator requires [`reanalyze`](https://github.com/rescript-lang/reanalyze), a code analysis tool for ReScript, to be installed. [Click here to read about how you get started with reanalyze.](https://github.com/rescript-lang/reanalyze).
10+
11+
`@throws` is picked up by reanalyze's exception analysis, and acknowledges that a function can throw exceptions that are not caught, and suppresses a warning in that case. Callers of the functions are then subjected to the same rule. Example `@throws(Exn)` or `@throws([E1, E2, E3])` for multiple exceptions.
12+
13+
### References
14+
15+
- [Reanalyze: Exception Analysis](https://github.com/rescript-lang/reanalyze/blob/master/EXCEPTION.md)

0 commit comments

Comments
 (0)