Detect possible exceptions

Suppose I want to have more confidence about the control flow in part of my program. Is it possible to detect what exceptions a function might throw?

E.g. is that something JET can do? @aviatesk

yes, but I’m wondering what kind of examples you have in mind.

For example, it would be interesting to have a safe environment where no exceptions can happen and errors need to be managed by ResultTypes.jl.

function integer_division(x::Int, y::Int)::Result{Int, DivideError}
    if y == 0
        return DivideError()
        return div(x, y)

Or detect allocations that might result in out-of-memory errors.