Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
PyRCS
PyRCS

Getting Started

  • Installation
  • Quick Start

Usage & Reference

  • Subpackages
    • line_data
      • ELRMileages
        • ELRMileages.KEY
        • ELRMileages.KEY_TO_LAST_UPDATED_DATE
        • ELRMileages.NAME
        • ELRMileages.URL
        • ELRMileages.collect_elr
        • ELRMileages.collect_mileage_file
        • ELRMileages.fetch_elr
        • ELRMileages.fetch_mileage_file
        • ELRMileages.get_conn_mileages
        • ELRMileages.search_conn
      • Electrification
        • Electrification.KEY
        • Electrification.KEY_TO_ETZ
        • Electrification.KEY_TO_INDEPENDENT_LINES
        • Electrification.KEY_TO_LAST_UPDATED_DATE
        • Electrification.KEY_TO_NATIONAL_NETWORK
        • Electrification.KEY_TO_OHNS
        • Electrification.NAME
        • Electrification.URL
        • Electrification.collect_etz_codes
        • Electrification.collect_independent_lines_codes
        • Electrification.collect_national_network_codes
        • Electrification.collect_ohns_codes
        • Electrification.fetch_codes
        • Electrification.fetch_etz_codes
        • Electrification.fetch_independent_lines_codes
        • Electrification.fetch_national_network_codes
        • Electrification.fetch_ohns_codes
        • Electrification.get_independent_lines_catalogue
      • LocationIdentifiers
        • LocationIdentifiers.KEY
        • LocationIdentifiers.KEY_TO_LAST_UPDATED_DATE
        • LocationIdentifiers.KEY_TO_MSCEN
        • LocationIdentifiers.KEY_TO_NOTES
        • LocationIdentifiers.KEY_TO_OTHER_SYSTEMS
        • LocationIdentifiers.NAME
        • LocationIdentifiers.URL
        • LocationIdentifiers.collect_loc_id
        • LocationIdentifiers.collect_notes
        • LocationIdentifiers.collect_other_systems_codes
        • LocationIdentifiers.fetch_codes
        • LocationIdentifiers.fetch_loc_id
        • LocationIdentifiers.fetch_notes
        • LocationIdentifiers.fetch_other_systems_codes
        • LocationIdentifiers.make_xref_dict
      • LOR
        • LOR.KEY
        • LOR.KEY_ELC
        • LOR.KEY_P
        • LOR.KEY_TO_LAST_UPDATED_DATE
        • LOR.NAME
        • LOR.SHORT_NAME
        • LOR.URL
        • LOR.collect_codes
        • LOR.collect_elr_lor_converter
        • LOR.collect_keys_to_prefixes
        • LOR.collect_page_urls
        • LOR.fetch_codes
        • LOR.fetch_elr_lor_converter
        • LOR.get_keys_to_prefixes
        • LOR.get_page_urls
        • LOR.get_url
        • LOR.validate_prefix
      • LineNames
        • LineNames.KEY
        • LineNames.KEY_TO_LAST_UPDATED_DATE
        • LineNames.NAME
        • LineNames.URL
        • LineNames.collect_codes
        • LineNames.fetch_codes
      • TrackDiagrams
        • TrackDiagrams.KEY
        • TrackDiagrams.KEY_TO_LAST_UPDATED_DATE
        • TrackDiagrams.NAME
        • TrackDiagrams.URL
        • TrackDiagrams.collect_catalogue
        • TrackDiagrams.fetch_catalogue
      • Bridges
        • Bridges.KEY
        • Bridges.KEY_TO_LAST_UPDATED_DATE
        • Bridges.NAME
        • Bridges.URL
        • Bridges.collect_codes
        • Bridges.fetch_codes
    • other_assets
      • SignalBoxes
        • SignalBoxes.KEY
        • SignalBoxes.KEY_TO_BELL_CODES
        • SignalBoxes.KEY_TO_IRELAND
        • SignalBoxes.KEY_TO_LAST_UPDATED_DATE
        • SignalBoxes.KEY_TO_NON_NATIONAL_RAIL
        • SignalBoxes.KEY_TO_WRMASD
        • SignalBoxes.NAME
        • SignalBoxes.URL
        • SignalBoxes.collect_bell_codes
        • SignalBoxes.collect_ireland_codes
        • SignalBoxes.collect_non_national_rail_codes
        • SignalBoxes.collect_prefix_codes
        • SignalBoxes.collect_wr_mas_dates
        • SignalBoxes.fetch_bell_codes
        • SignalBoxes.fetch_ireland_codes
        • SignalBoxes.fetch_non_national_rail_codes
        • SignalBoxes.fetch_prefix_codes
        • SignalBoxes.fetch_wr_mas_dates
      • Tunnels
        • Tunnels.KEY
        • Tunnels.KEY_TO_LAST_UPDATED_DATE
        • Tunnels.NAME
        • Tunnels.URL
        • Tunnels.collect_codes
        • Tunnels.fetch_codes
      • Viaducts
        • Viaducts.KEY
        • Viaducts.KEY_TO_LAST_UPDATED_DATE
        • Viaducts.NAME
        • Viaducts.URL
        • Viaducts.collect_codes
        • Viaducts.fetch_codes
      • Stations
        • Stations.KEY
        • Stations.KEY_TO_LAST_UPDATED_DATE
        • Stations.KEY_TO_STN
        • Stations.NAME
        • Stations.URL
        • Stations.collect_catalogue
        • Stations.collect_locations
        • Stations.fetch_catalogue
        • Stations.fetch_locations
      • Depots
        • Depots.KEY
        • Depots.KEY_TO_1950_SYSTEM
        • Depots.KEY_TO_GWR
        • Depots.KEY_TO_LAST_UPDATED_DATE
        • Depots.KEY_TO_PRE_TOPS
        • Depots.KEY_TO_TOPS
        • Depots.NAME
        • Depots.URL
        • Depots.collect_1950_system_codes
        • Depots.collect_gwr_codes
        • Depots.collect_pre_tops_codes
        • Depots.collect_tops_codes
        • Depots.fetch_1950_system_codes
        • Depots.fetch_codes
        • Depots.fetch_gwr_codes
        • Depots.fetch_pre_tops_codes
        • Depots.fetch_tops_codes
      • Features
        • Features.KEY
        • Features.KEY_TO_BUZZER
        • Features.KEY_TO_HABD_WILD
        • Features.KEY_TO_LAST_UPDATED_DATE
        • Features.KEY_TO_TELEGRAPH
        • Features.KEY_TO_TROUGH
        • Features.NAME
        • Features.URL
        • Features.fetch_codes
      • HabdWild
        • HabdWild.KEY
        • HabdWild.KEY_TO_LAST_UPDATED_DATE
        • HabdWild.NAME
        • HabdWild.URL
        • HabdWild.collect_codes
        • HabdWild.fetch_codes
      • WaterTroughs
        • WaterTroughs.KEY
        • WaterTroughs.KEY_TO_LAST_UPDATED_DATE
        • WaterTroughs.NAME
        • WaterTroughs.URL
        • WaterTroughs.collect_codes
        • WaterTroughs.fetch_codes
      • Telegraph
        • Telegraph.KEY
        • Telegraph.KEY_TO_LAST_UPDATED_DATE
        • Telegraph.NAME
        • Telegraph.URL
        • Telegraph.collect_codes
        • Telegraph.fetch_codes
      • Buzzer
        • Buzzer.KEY
        • Buzzer.KEY_TO_LAST_UPDATED_DATE
        • Buzzer.NAME
        • Buzzer.URL
        • Buzzer.collect_codes
        • Buzzer.fetch_codes
  • Modules
    • parser
      • parse_tr
      • parse_table
      • parse_date
      • get_site_map
      • get_last_updated_date
      • get_financial_year
      • get_catalogue
      • get_category_menu
      • get_page_catalogue
      • get_heading_text
      • get_hypertext
      • get_introduction
    • converter
      • fix_mileage
      • yard_to_mileage
      • mileage_to_yard
      • mile_chain_to_mileage
      • mileage_to_mile_chain
      • mile_yard_to_mileage
      • mileage_str_to_num
      • mileage_num_to_str
      • shift_mileage_by_yard
      • fix_stanox
      • kilometer_to_yard
    • collector
      • LineData
        • LineData.NAME
        • LineData.update
      • OtherAssets
        • OtherAssets.NAME
        • OtherAssets.update
    • utils
      • is_homepage_connectable
      • is_str_float
      • validate_initial
      • validate_page_name
      • get_collect_verbosity_for_fetch
      • get_batch_fetch_verbosity
      • format_confirmation_prompt
      • print_collection_message
      • print_connection_warning
      • print_instance_connection_error
      • print_void_collection_message
      • fetch_location_names_errata

Additional Info

  • License
  • Use of Data
  • Acknowledgement
  • Contributors
Back to top

print_instance_connection_error¶

pyrcs.utils.print_instance_connection_error(update=False, verbose=False, e=None, raise_error=False)[source]¶

Handles connection errors during data retrieval or update processes.

This function processes connection failures by printing targeted feedback based on the verbosity configuration, while offering options to suppress or propagate errors.

Parameters:
  • update (bool) – Indicates whether the error occurred during a data update. Defaults to False.

  • verbose (bool | int) – Whether to print relevant information to the console. Defaults to False.

  • e (Exception | None) – An optional exception instance to display or raise.

  • raise_error (bool) – Whether to raise the exception; if False (default), the error is suppressed.

Returns:

None if the exception is suppressed.

Return type:

None

Raises:
  • ConnectionError – If raise_error is True and no exception e is provided.

  • Exception – Re-raises e if raise_error is True.

Examples:

>>> from pyrcs.utils import print_instance_connection_error

>>> print_instance_connection_error(verbose=True)
The Internet connection is not available.

>>> print_instance_connection_error(update=True, verbose=True)
The Internet connection is not available. Failed to update the data.

>>> print_instance_connection_error(update=True, verbose=2, raise_error=True)
Failed. The Internet connection is not available. Failed to update the data.
Traceback (most recent call last):
  ...
    ...
TypeError: exceptions must derive from BaseException
Next
print_void_collection_message
Previous
print_connection_warning
Copyright © 2019-2026 Qian Fu
Made with Sphinx and @pradyunsg's Furo
On this page
  • print_instance_connection_error
    • print_instance_connection_error()