Made treat controller exceptions return the given function type.