note
	description: "Common exception operations and management."
	library: "Free implementation of ELKS library"
	status: "See notice at end of class."
	legal: "See notice at end of class."
	date: "$Date: 2018-04-28 20:47:11 +0000 (Sat, 28 Apr 2018) $"
	revision: "$Revision: 101695 $"

class 
	EXCEPTION_MANAGER

create 
	default_create

feature -- Access

	last_exception: detachable EXCEPTION
			-- Last exception
		do
			Result := (create {EXCEPTION_MANAGER_FACTORY}).Exception_manager.last_exception
		ensure
			instance_free: class
		end
	
feature -- Raise

	raise (a_exception: EXCEPTION)
			-- Raise a_exception.
		require
			a_exception_not_void: a_exception /= Void
			a_exception_is_raisable: a_exception.is_raisable
		do
			(create {EXCEPTION_MANAGER_FACTORY}).Exception_manager.raise (a_exception)
		ensure
			instance_free: class
		end
	
feature -- Status setting

	ignore (a_exception: TYPE [detachable EXCEPTION])
			-- Ignore type of a_exception.
		require
			a_exception_not_void: a_exception /= Void
			is_ignorable: is_ignorable (a_exception)
		do
			(create {EXCEPTION_MANAGER_FACTORY}).Exception_manager.ignore (a_exception)
		ensure
			instance_free: class
			is_caught: is_ignored (a_exception)
		end

	catch (a_exception: TYPE [detachable EXCEPTION])
			-- Set type of a_exception is_caught.
		require
			a_exception_not_void: a_exception /= Void
		do
			(create {EXCEPTION_MANAGER_FACTORY}).Exception_manager.catch (a_exception)
		ensure
			instance_free: class
			is_ignored: not is_ignored (a_exception)
		end

	set_is_ignored (a_exception: TYPE [detachable EXCEPTION]; a_ignored: BOOLEAN)
			-- Set type of a_exception to be a_ignored.
		require
			a_exception_not_void: a_exception /= Void
			a_ignored_implies_is_ignorable: a_ignored implies is_ignorable (a_exception)
		do
			(create {EXCEPTION_MANAGER_FACTORY}).Exception_manager.set_is_ignored (a_exception, a_ignored)
		ensure
			instance_free: class
			is_ignored_set: is_ignored (a_exception) = a_ignored
		end
	
feature -- Status report

	is_ignorable (a_exception: TYPE [detachable EXCEPTION]): BOOLEAN
			-- If set, type of a_exception is ignorable.
		do
			Result := (create {EXCEPTION_MANAGER_FACTORY}).Exception_manager.is_ignorable (a_exception)
		ensure
			instance_free: class
		end

	is_raisable (a_exception: TYPE [detachable EXCEPTION]): BOOLEAN
			-- If set, type of a_exception is raisable.
		do
			Result := (create {EXCEPTION_MANAGER_FACTORY}).Exception_manager.is_raisable (a_exception)
		ensure
			instance_free: class
		end

	is_ignored (a_exception: TYPE [detachable EXCEPTION]): BOOLEAN
			-- If set, type of a_exception is not raised.
		do
			Result := (create {EXCEPTION_MANAGER_FACTORY}).Exception_manager.is_ignored (a_exception)
		ensure
			instance_free: class
			not_is_caught: Result = not is_caught (a_exception)
		end

	is_caught (a_exception: TYPE [detachable EXCEPTION]): BOOLEAN
			-- If set, type of a_exception is raised.
		do
			Result := (create {EXCEPTION_MANAGER_FACTORY}).Exception_manager.is_caught (a_exception)
		ensure
			instance_free: class
			not_is_ignored: Result = not is_ignored (a_exception)
		end
	
feature {EXCEPTIONS} -- Backward compatibility support

	type_of_code (a_code: INTEGER_32): detachable TYPE [EXCEPTION]
			-- Exception type of a_code
		do
		ensure
			instance_free: class
		end

	exception_from_code (a_code: INTEGER_32): detachable EXCEPTION
			-- Create exception object from a_code
		do
		ensure
			instance_free: class
		end
	
note
	copyright: "Copyright (c) 1984-2018, Eiffel Software and others"
	license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
	source: "[
		Eiffel Software
		5949 Hollister Ave., Goleta, CA 93117 USA
		Telephone 805-685-1006, Fax 805-685-6869
		Website http://www.eiffel.com
		Customer support http://support.eiffel.com
	]"

end -- class EXCEPTION_MANAGER

Generated by ISE EiffelStudio