def _loading_failed(self, error): self.progressDialog.cancel() try: raise error except RequestException as e: if e.error_code == 400: # command to ask data probably invalid or there is a problem with current station self.parent.show_error_alerts(Messages.weatherstation_error() + str(e)) else: self.parent.show_error_alerts(Messages.unknown_error() + str(e)) except InvalidApikeyException: # apikey is invalid self.parent.show_error_alerts(Messages.request_failed_error()) except NoDataException: self.parent.show_error_alerts(Messages.date_not_found_error()) except QueryLimitException as e: self.parent.show_error_alerts(Messages.query_limit_error().format(e.wait_time)) except Exception as e: self.parent.show_error_alerts(Messages.unknown_error() + str(e))
def _background_fmicatalogue_error(self, err): """ Handle errors which happened in fmi catalogue retrieval background thread. This is a error callback function provided for BackgroundTask class on construction. :param err: :return: """ if hasattr(err, 'error_code'): if err.error_code == 'NODATASETS': self.show_error_alerts(Messages.no_datasets_found()) elif err.error_code == 'METADATA_RETRIEVAL': self.show_error_alerts(Messages.fmicatalogue_error()) else: self.show_error_alerts(Messages.unknown_error() + str(err)) else: self.show_error_alerts(Messages.unknown_error() + str(err)) self._current_available_datasets = None self._current_selected_dataset = None self.ui.dataSelectionCombobox.clear() self._set_ui_controls_status()