Skip to content

Commit a749f21

Browse files
authored
use KeyError instead of AttributeError
1 parent 0ac9188 commit a749f21

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/ci/docker/scripts/fuchsia-test-runner.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ def build_id(self, binary):
202202
raise Exception(f"JSON returned by llvm-readelf for binary {binary} is not a list with a single entry")
203203

204204
try:
205-
note_sections = getattr(elf_output[0], "NoteSections")
206-
except AttributeError as e:
205+
note_sections = elf_output[0]["NoteSections"]
206+
except KeyError as e:
207207
e.add_note(f'Failed to read "NoteSections" from llvm-readelf for binary {binary}')
208208
raise
209209

@@ -212,7 +212,7 @@ def build_id(self, binary):
212212
note_section = entry["NoteSection"]
213213
if note_section["Name"] == ".note.gnu.build-id":
214214
return note_section["Note"]["Build ID"]
215-
except AttributeError as e:
215+
except KeyError as e:
216216
e.add_note(f'Failed to read ".note.gnu.build-id" from NoteSections entry in llvm-readelf for binary {binary}')
217217
raise
218218
raise Exception(f"Build ID not found for binary {binary}")

0 commit comments

Comments
 (0)