You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The paragraph "Exception" of the Rascal documentation should contain a (simple) example to explain the use of the "try-catch" structure for beginners, especially regarding the "PatternWithAction" (and also link to the respective paragraph). Also a backlink from PatterWithAction towards Exception is missing.
Furthermore some unexpected behaviour can occur because the module "Exception" is not loaded by default.
The Exception is wrongly caught by the statement "catch PathNotFound".
now let's add the statement "import Exception;" to the above program and rerun the program.
Created 2009-11-30 by [email protected] assigned to [email protected]
The paragraph "Exception" of the Rascal documentation should contain a (simple) example to explain the use of the "try-catch" structure for beginners, especially regarding the "PatternWithAction" (and also link to the respective paragraph). Also a backlink from PatterWithAction towards Exception is missing.
Furthermore some unexpected behaviour can occur because the module "Exception" is not loaded by default.
Let's assume the following program:
module BugTest import Map; import IO; public int main() { try invertUnique(("a": 3, "b": 6, "c": 6 )); catch "some text": println("catch str"); catch 11: println("catch Mark int"); catch PathNotFound: println("catch PathNotFound"); catch MultipleKey: println("catch MultipleKey"); catch: println("catch default"); finally println("finally block"); return 0; }Let's start the program:
[1] rascal>import BugTest; ok[2] rascal>main()
catch PathNotFound
finally block
int: 0
The Exception is wrongly caught by the statement "catch PathNotFound".
[3] rascal>import BugTest; oknow let's add the statement "import Exception;" to the above program and rerun the program.
[4] rascal>main();
catch MultipleKey
finally block
int: 0
rascal>
The Exception is now correctly identified as a MultipleKey Exception as is should always be.
The text was updated successfully, but these errors were encountered: