File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 22Defines common socketcan functions.
33"""
44
5+ import errno
56import logging
67import os
7- import errno
8+ import re
89import struct
910import subprocess
10- import re
1111from typing import cast , Iterable , Optional
1212
1313from can .interfaces .socketcan .constants import CAN_EFF_FLAG
@@ -73,7 +73,7 @@ def error_code_to_str(code: Optional[int]) -> str:
7373 :returns: a string explaining and containing the given error code, or a string
7474 explaining that the errorcode is unknown if that is the case
7575 """
76- name = errno .errorcode .get (code , "UNKNOWN" )
77- description = os .strerror (code )
76+ name = errno .errorcode .get (code , "UNKNOWN" ) if code is not None else "UNKNOWN"
77+ description = os .strerror (code ) if code is not None else "NO DESCRIPTION AVAILABLE"
7878
7979 return f"{ name } (errno { code } ): { description } "
You can’t perform that action at this time.
0 commit comments