error-handling: does not show how to deal with errors
- Dominant language
- F#
- Stars
- 118
- Forks
- 113
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 2
Description
TL;DR: I'm missing in this exercise how to handle exceptions thrown (or anay other kind of error bubble) in code called by me and how to properly clean up then.
---
This exercises shows me how to use `failwith`, `Option<'T>` and `Result<'TOk, 'Terror>` when I want to return it.
It briefly touches how to deal with a `Result` that is passed in via the `bind` function, but not how to deal with a result returned from another function I've called.
But so far nothing new. We have already returned `Option`s and `Result`s earlier in the track, so that is nothing new, we did already pattern matching to unwrap our own types, so thats nothing different than the incomming `Result` in `bind`…
The only thing that is really new, is that we are asked to dispose some object. But wait, what are objects, how to dispose? What oh, I have to call `Dispose()` from `IDisposable`? Whats that? An interface? Aha… Good luck I have heard of thise things in OOP classes already… So just do it…
In my opinion, this exercise would gain a lot, if we actually had to handle real errors instead of just creating them from nothing.
Eg. in the `go` track, we get some kind of resource which we have to open, close, write to, etc, pp. Depending on the current testcase, it will return an error value or raise a panic, and then the student has to react and close the resource handle, or do a retry, or recover from the panic. Here the student has to actually handle errors that were created elsewhere. Thats an example of the exercise I learnt a lot from…
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.