Skip to content

Commit 2522187

Browse files
Merge pull request #841 from IntelPython/use-try-catch-in-program-constructor-call
Catch exceptions that sycl::program::program can throw
1 parent b05e041 commit 2522187

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

libsyclinterface/source/dpctl_sycl_program_interface.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,12 @@ DPCTLProgram_CreateFromOCLSource(__dpctl_keep const DPCTLSyclContextRef Ctx,
256256
}
257257

258258
SyclCtx = unwrap(Ctx);
259-
SyclProgram = new program(*SyclCtx);
259+
try {
260+
SyclProgram = new program(*SyclCtx);
261+
} catch (std::exception const &e) {
262+
error_handler(e, __FILE__, __func__, __LINE__);
263+
return nullptr;
264+
}
260265
std::string source = Source;
261266

262267
if (CompileOpts) {

0 commit comments

Comments
 (0)