Emiting to port safely and handling exceptions