How to use `raises`
What does the
raises
keyword do for error handling, how do I use it, and what does it returns if the function fails? All I could in the docs was "Both support raising exceptions, but this must be explicitly declared on a fn with the raises keyword." If its for raising exceptions, how do I do this properly?3 Replies
What happens if they fail? Just a normal error?
Is this essentially just a way to say one is aware that the code may not work?
Yeah application will throw an error, you can experiment and force errors. Modern language users expect to know if a function could potentially raise an error, and have the compiler warn them they're not handling it the potential for an error correctly.