How do I help the F# compiler interpret re-throwing an exception as having no return value?
For example, consider wrapping an operation to log the exception:
let doDivision() =
try
2 / 0
with ex ->
log ex
reraise
The compiler reports this error for reraise
:
This expression was expected to have type
int
but here has typeunit -> 'a
"reraise" is a function. You need to pass unit to it.
let doDivision() =
try
2 / 0
with ex ->
log ex
reraise ()