Any exception raised in a remote method or subprogram call is propagated back to the caller. Exception semantics are preserved in the regular Ada way.
package Internal is Exc : exception; end Internal;
package RemPkg2 is pragma Remote_Call_Interface; procedure Subprogram; end RemPkg2;
package RemPkg1 is pragma Remote_Call_Interface; procedure Subprogram; end RemPkg1;
Let us say that RemPkg2, Internal and RemExcMain packages are on the same partition Partition_1 and that RemPkg1 is on partition Partition_2.
with RemPkg1, Ada.Exceptions; use Ada.Exceptions; package body RemPkg2 is procedure Subprogram is begin RemPkg1.Subprogram; exception when E : others => Raise_Exception (Exception_Identity (E), Exception_Message (E)); end Subprogram; end RemPkg2;
with Internal, Ada.Exceptions; use Ada.Exceptions; package body RemPkg1 is procedure Subprogram is begin Raise_Exception (Internal.Exc'Identity, "Message"); end Subprogram; end RemPkg1;
with Ada.Text_IO, Ada.Exceptions; use Ada.Text_IO, Ada.Exceptions; with RemPkg2, Internal; procedure RemExcMain is begin RemPkg2.Subprogram; exception when E : Internal.Exc => Put_Line (Exception_Message (E)); -- Output "Message" end RemExcMain;
When RemPkg1.Subprogram on Partition_1 raises Internal.Exc, this exception is propagated back to Partition_2. As Internal.Exc is not defined on Partition_2, it is not possible to catch this exception without an exception handler when others. When this exception is reraised in RemPkg1.Subprogram, it is propagated back to Partition_1. But this time, Internal.Exc is visible and can be handled as we would in a single-partition Ada program. Of course, the exception message is also preserved.