Spaces:
Build error
Build error
| def read_file_content(file_path: str) -> str: | |
| """ | |
| Reads and returns the content of a file. | |
| Args: | |
| file_path (str): The path to the file to read. | |
| Returns: | |
| str: The content of the file. | |
| Raises: | |
| FileNotFoundError: If the file does not exist. | |
| IOError: If the file cannot be read. | |
| """ | |
| try: | |
| with open(file_path, "r") as file: | |
| content = file.read() | |
| return content | |
| except FileNotFoundError: | |
| raise FileNotFoundError(f"The file '{file_path}' does not exist.") | |
| except IOError: | |
| raise IOError(f"Unable to read the file '{file_path}'.") | |