Skip to content

Commit 86ee1d1

Browse files
committed
move throw to Pervasives.res
1 parent 98cc917 commit 86ee1d1

File tree

7 files changed

+19
-49
lines changed

7 files changed

+19
-49
lines changed

lib/es6/Stdlib.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function assertEqual(a, b) {
1212
RE_EXN_ID: "Assert_failure",
1313
_1: [
1414
"Stdlib.res",
15-
134,
15+
117,
1616
4
1717
],
1818
Error: new Error()

lib/js/Stdlib.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ function assertEqual(a, b) {
1212
RE_EXN_ID: "Assert_failure",
1313
_1: [
1414
"Stdlib.res",
15-
134,
15+
117,
1616
4
1717
],
1818
Error: new Error()

runtime/Pervasives.res

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,23 @@ let invalid_arg = s => throw(Invalid_argument(s))
2525

2626
@deprecated("Use custom exception instead") exception Exit
2727

28+
/**
29+
Throw and exception which will stop execution.
30+
31+
## Examples
32+
33+
```rescript
34+
let error = Error.make("Everything is upside down.")
35+
36+
if 5 > 10 {
37+
error->throw
38+
} else {
39+
Console.log("Phew, sanity still rules.")
40+
}
41+
```
42+
*/
43+
external throw: Stdlib_Error.t => 'a = "%raise"
44+
2845
/* Composition operators */
2946

3047
external \"|>": ('a, 'a => 'b) => 'b = "%revapply"

runtime/Stdlib.res

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -101,23 +101,6 @@ external import: 'a => promise<'a> = "%import"
101101

102102
let panic = Error.panic
103103

104-
/**
105-
Throw and exception which will stop execution.
106-
107-
## Examples
108-
109-
```rescript
110-
let error = Error.make("Everything is upside down.")
111-
112-
if 5 > 10 {
113-
error->throw
114-
} else {
115-
Console.log("Phew, sanity still rules.")
116-
}
117-
```
118-
*/
119-
external throw: Error.t => 'a = "%raise"
120-
121104
/**
122105
`assertEqual(a, b)` check if `a` is equal `b`. If not raise a panic exception
123106

tests/analysis_tests/tests/src/expected/CompletionExpressions.res.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -369,12 +369,6 @@ Path fnTakingRecord
369369
"detail": "bool",
370370
"documentation": null,
371371
"sortText": "A true"
372-
}, {
373-
"label": "throw",
374-
"kind": 12,
375-
"tags": [],
376-
"detail": "Error.t => 'a",
377-
"documentation": {"kind": "markdown", "value": "\nThrow and exception which will stop execution.\n\n## Examples\n\n```rescript\nlet error = Error.make(\"Everything is upside down.\")\n\nif 5 > 10 {\n error->throw\n} else {\n Console.log(\"Phew, sanity still rules.\")\n}\n```\n"}
378372
}, {
379373
"label": "typeof",
380374
"kind": 12,

tests/analysis_tests/tests/src/expected/CompletionFunctionArguments.res.txt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,6 @@ Path someFn
4343
"tags": [],
4444
"detail": "bool",
4545
"documentation": null
46-
}, {
47-
"label": "throw",
48-
"kind": 12,
49-
"tags": [],
50-
"detail": "Error.t => 'a",
51-
"documentation": {"kind": "markdown", "value": "\nThrow and exception which will stop execution.\n\n## Examples\n\n```rescript\nlet error = Error.make(\"Everything is upside down.\")\n\nif 5 > 10 {\n error->throw\n} else {\n Console.log(\"Phew, sanity still rules.\")\n}\n```\n"}
5246
}, {
5347
"label": "typeof",
5448
"kind": 12,
@@ -373,12 +367,6 @@ Path someOtherFn
373367
"tags": [],
374368
"detail": "bool",
375369
"documentation": null
376-
}, {
377-
"label": "throw",
378-
"kind": 12,
379-
"tags": [],
380-
"detail": "Error.t => 'a",
381-
"documentation": {"kind": "markdown", "value": "\nThrow and exception which will stop execution.\n\n## Examples\n\n```rescript\nlet error = Error.make(\"Everything is upside down.\")\n\nif 5 > 10 {\n error->throw\n} else {\n Console.log(\"Phew, sanity still rules.\")\n}\n```\n"}
382370
}, {
383371
"label": "typeof",
384372
"kind": 12,

tests/analysis_tests/tests/src/expected/CompletionJsxProps.res.txt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,6 @@ Path CompletionSupport.TestComponent.make
3535
"detail": "bool",
3636
"documentation": null,
3737
"sortText": "A true"
38-
}, {
39-
"label": "throw",
40-
"kind": 12,
41-
"tags": [],
42-
"detail": "Error.t => 'a",
43-
"documentation": {"kind": "markdown", "value": "\nThrow and exception which will stop execution.\n\n## Examples\n\n```rescript\nlet error = Error.make(\"Everything is upside down.\")\n\nif 5 > 10 {\n error->throw\n} else {\n Console.log(\"Phew, sanity still rules.\")\n}\n```\n"}
4438
}, {
4539
"label": "typeof",
4640
"kind": 12,
@@ -379,12 +373,6 @@ Path CompletionSupport.TestComponent.make
379373
"tags": [],
380374
"detail": "[> #two]",
381375
"documentation": null
382-
}, {
383-
"label": "throw",
384-
"kind": 12,
385-
"tags": [],
386-
"detail": "Error.t => 'a",
387-
"documentation": {"kind": "markdown", "value": "\nThrow and exception which will stop execution.\n\n## Examples\n\n```rescript\nlet error = Error.make(\"Everything is upside down.\")\n\nif 5 > 10 {\n error->throw\n} else {\n Console.log(\"Phew, sanity still rules.\")\n}\n```\n"}
388376
}, {
389377
"label": "typeof",
390378
"kind": 12,

0 commit comments

Comments
 (0)