2 ms·
Oh, thank you for spotting the error. Of course, there should be `fileAge.catch` there. I'll fix that in a moment. I will prepare a visual example of exceptions
by wdanilo 11y ago
Oh, thank you for spotting the error. Of course, there should be `fileAge.catch` there. I'll fix that in a moment. I will prepare a visual example of exceptions and put it in the website later today. For now think of it like that: running an operation results in a data and this data is transmitted over connection between nodes. If you read data from file it can be "broken" in different ways, for example it did not exist on disk. If you convert it to integer - it still could be broken or become broken (for example we were not able to convert this text to integer). So far you've got such graph of nodes: open --> to Int --> ... and the resulting edge could be broken if one of the exceptions occured. If you put there `catch` node you can either double click it and define its subgraph, that has input of the `e` variable or simply connect other input that would be used if the error occurs. Thats all - in contrast to imperative languages exceptions in Luna do NOT propagate over blocks of code - they propagate over the data dependencies. In fact the exceptions in Luna are just algebraic data structures that could have 2 values - Just ok or Error e - something like Either in Haskell (side note for Haskellers). Does it make sense to you? :)