@@ -18,12 +18,23 @@ namespace openvino_ep {
1818
1919template <typename Func, typename ... Args>
2020inline auto OvExceptionBoundary (Func&& func, std::format_string<Args...>&& fmt, Args&&... args) {
21+ return OvExceptionBoundary (func, ORT_EP_FAIL, std::forward<std::format_string<Args...>>(fmt), std::forward<Args>(args)...);
22+ }
23+
24+ template <typename Func, typename ... Args>
25+ inline auto OvExceptionBoundary (Func&& func, OrtErrorCode error_code, std::format_string<Args...>&& fmt, Args&&... args) {
2126 try {
2227 return func ();
2328 } catch (const ov::Exception& e) {
24- ORT_THROW (log_tag + std::vformat (fmt.get (), std::make_format_args (args...)) + " : " + std::string (e.what ()));
29+ // Encode error code as prefix: "<code>|message"
30+ auto msg = std::format (" {}|{}{}: {}" , static_cast <int >(error_code), log_tag,
31+ std::vformat (fmt.get (), std::make_format_args (args...)), e.what ());
32+ ORT_THROW (msg);
2533 } catch (...) {
26- ORT_THROW (log_tag + std::vformat (fmt.get (), std::make_format_args (args...)));
34+ // Encode error code as prefix: "<code>|message"
35+ auto msg = std::format (" {}|{}{}" , static_cast <int >(error_code), log_tag,
36+ std::vformat (fmt.get (), std::make_format_args (args...)));
37+ ORT_THROW (msg);
2738 }
2839}
2940
@@ -214,7 +225,8 @@ OVExeNetwork OVCore::ImportModel(ModelBlobWrapper& model_blob,
214225#endif
215226 return exe;
216227 },
217- " Exception while Loading Network for graph {}" , name);
228+ ORT_INVALID_GRAPH,
229+ " Exception while importing model for graph {}" , name);
218230}
219231
220232OVExeNetwork OVCore::ImportEPCtxOVIREncapsulation (std::istream& model_stream,
0 commit comments