Add exception handler for marshaling