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()
    else
        return div(x, y)
    end
end

https://doc.rust-lang.org/book/ch09-03-to-panic-or-not-to-panic.html

https://crates.io/crates/no-panic/0.1.15/

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