Skip to content

Commit 5e1ff70

Browse files
If default_context is unavailable, raise SyclContextCreationError
1 parent c317e9c commit 5e1ff70

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

dpctl/_sycl_platform.pyx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,14 +267,20 @@ cdef class SyclPlatform(_SyclPlatform):
267267
"""Returns the default platform context for this platform
268268
269269
Returns:
270-
SyclContext: The default context for the platform.
270+
SyclContext
271+
The default context for the platform.
272+
Raises:
273+
SyclContextCreationError
274+
If default_context is not supported
271275
"""
272276
cdef DPCTLSyclContextRef CRef = (
273277
DPCTLPlatform_GetDefaultContext(self._platform_ref)
274278
)
275279

276280
if (CRef == NULL):
277-
raise RuntimeError("Getting default error ran into a problem")
281+
raise SyclContextCreationError(
282+
"Getting default_context ran into a problem"
283+
)
278284
else:
279285
return SyclContext._create(CRef)
280286

0 commit comments

Comments
 (0)