Un manejador de excepciones es un trozo de código encargado de controlar determinadas excepciones que se puedan producir al ejecutar una secuencia de instrucciones controlada (handled_sequence_of_statements ).
handled_sequence_of_statements ::= sequence_of_statements [exception exception_handler {exception_handler}]
exception_handler ::= when [choice_parameter_specification:] exception_choice {| exception_choice} => sequence_of_statements choice_parameter_specification ::= defining_identifier exception_choice ::= exception_name | others
with Ada.Float_Text_IO; use Ada.Float_Text_IO;
procedure Divide is X, Y, D: Float; PD : access Float; begin Get (X); Get (Y); D := Float(X) / Float(Y); PD := new Float'(D); Put (D); exception when Data_Error | Constraint_Error => put_line("Error en los datos"); when Storage_Error => put_line("Memoria insuficiente"); when others => put_line("Error inesperado"); end Divide;