Catch and handle regex exception

When pattern matching file names to determine API support, in
some environments std::regex will throw. This change is meant
to handle this more gracefully.

Change-Id: If1ccfe5bdd71ec4d08663c80692024488072e11b
Этот коммит содержится в:
Chris Freehill
2020-05-13 14:35:58 -05:00
родитель b7ff71c001
Коммит 27148a02cb
2 изменённых файлов: 41 добавлений и 24 удалений
+11 -4
Просмотреть файл
@@ -161,10 +161,17 @@ static rsmi_status_t handleException() {
// This macro assumes dev already available
#define CHK_API_SUPPORT_ONLY(RT_PTR, VR, SUB_VR) \
if ((RT_PTR) == nullptr) { \
if (!dev->DeviceAPISupported(__FUNCTION__, (VR), (SUB_VR))) { \
return RSMI_STATUS_NOT_SUPPORTED; \
} \
return RSMI_STATUS_INVALID_ARGS; \
try { \
if (!dev->DeviceAPISupported(__FUNCTION__, (VR), (SUB_VR))) { \
return RSMI_STATUS_NOT_SUPPORTED; \
} \
return RSMI_STATUS_INVALID_ARGS; \
} catch (const amd::smi::rsmi_exception& e) { \
debug_print( \
"Exception caught when checking if API is supported %s.\n", \
e.what()); \
return RSMI_STATUS_INVALID_ARGS; \
} \
}
#define CHK_SUPPORT(RT_PTR, VR, SUB_VR) \