Commit a69004e
authored
[Core][Channel] Fix the exception type for accelerator ID visibility check in accelerator_context.py (ray-project#58269)
## Description
- Change the caught exception type from IndexError to TypeError
- This modification ensures that the correct exception is raised when
the expected accelerator ID is not included in the
accelerator_visible_list
`list.index` will raise a
[ValueError](https://docs.python.org/3/library/exceptions.html#ValueError)
if there is no such item.
https://docs.python.org/3/tutorial/datastructures.html
<img width="797" height="79" alt="image"
src="https://github.com/user-attachments/assets/830cf4aa-d9cb-44d3-9363-8e5cd576bae9"
/>
Now, the error logs will be correctly captured and printed.
<img width="1454" height="143" alt="image"
src="https://github.com/user-attachments/assets/2b0ed0aa-60c7-49c3-84b0-7f0d4f1ebe48"
/>
Signed-off-by: daiping8 <dai.ping88@zte.com.cn>1 parent 966cc94 commit a69004e
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
| 138 | + | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| |||
0 commit comments