I don't think you need to set this up? Composer already converts all errors to exceptions, and the RemoteFilesystem should throw TransportException on failures.