Cleanup error handling.

This commit is contained in:
James Pace 2025-11-22 12:35:08 -05:00
parent a6b490f049
commit 4cbde2749d
1 changed files with 4 additions and 4 deletions

View File

@ -38,7 +38,8 @@ class Facts:
build_info_getter_directory = None build_info_getter_directory = None
try: try:
build_info_getter_directory = get_package_share_directory('build_info_getter') build_info_getter_directory = get_package_share_directory('build_info_getter')
except: except Exception as e:
print("Can't find build info.\n{}".format(e))
return None return None
# Find and read the project_state.repos file in it. # Find and read the project_state.repos file in it.
project_state_file = build_info_getter_directory + "/project_state.repos" project_state_file = build_info_getter_directory + "/project_state.repos"
@ -46,11 +47,10 @@ class Facts:
try: try:
with open(project_state_file, 'r') as file_obj: with open(project_state_file, 'r') as file_obj:
project_state_content = yaml.safe_load(file_obj) project_state_content = yaml.safe_load(file_obj)
except: except Exception as e:
# We either didn't load the file or couldn't read it # We either didn't load the file or couldn't read it
# as json. # as json.
# If we ignore the error, we'll respond with a None which is the right thing. print("Can't find build info.\n{}".format(e))
pass
return project_state_content return project_state_content
class Routes: class Routes: