@@ -336,7 +336,7 @@ cdef int array_take1(GpuArray r, GpuArray a, GpuArray i,
336336 err = GpuArray_take1(& r.ga, & a.ga, & i.ga, check_err)
337337 if err != GA_NO_ERROR:
338338 if err == GA_VALUE_ERROR:
339- raise IndexError , " Index out of bounds "
339+ raise IndexError , GpuArray_error( & r.ga, err)
340340 raise get_exc(err), GpuArray_error(& r.ga, err)
341341
342342cdef int array_setarray(GpuArray v, GpuArray a) except - 1 :
@@ -1054,10 +1054,7 @@ cdef class GpuContext:
10541054 self .kind = kind
10551055 self .ctx = gpucontext_init(< char * > self .kind, devno, flags, & err)
10561056 if (err != GA_NO_ERROR):
1057- if err == GA_VALUE_ERROR:
1058- raise get_exc(err), " No device %d " % (devno,)
1059- else :
1060- raise get_exc(err), gpucontext_error(NULL , err).decode(' utf-8' ) + " : " + str (devno)
1057+ raise get_exc(err), gpucontext_error(NULL , err)
10611058
10621059 def __enter__ (self ):
10631060 if cuda_enter == NULL :
@@ -1415,10 +1412,7 @@ cdef GpuArray pygpu_index(GpuArray a, const ssize_t *starts,
14151412 const ssize_t * stops, const ssize_t * steps):
14161413 cdef GpuArray res
14171414 res = new_GpuArray(type (a), a.context, a.base)
1418- try :
1419- array_index(res, a, starts, stops, steps)
1420- except ValueError , e:
1421- raise IndexError , " index out of bounds"
1415+ array_index(res, a, starts, stops, steps)
14221416 return res
14231417
14241418cdef GpuArray pygpu_reshape(GpuArray a, unsigned int nd, const size_t * newdims,
@@ -1430,7 +1424,7 @@ cdef GpuArray pygpu_reshape(GpuArray a, unsigned int nd, const size_t *newdims,
14301424 return res
14311425 cdef unsigned int caxis = < unsigned int > compute_axis
14321426 if caxis >= nd:
1433- raise ValueError (" You wanted us to compute the shape of a dimensions that don't exist " )
1427+ raise ValueError (" compute_axis is out of bounds " )
14341428
14351429 cdef size_t * cdims
14361430 cdef size_t tot = 1
@@ -1554,7 +1548,7 @@ def open_ipc_handle(GpuContext c, bytes hpy, size_t l):
15541548
15551549 d = cuda_open_ipc_handle(c.ctx, & h, l)
15561550 if d is NULL :
1557- raise GpuArrayException, " could not open handle "
1551+ raise GpuArrayException, gpucontext_error(c.ctx, 0 )
15581552 return < size_t> d
15591553
15601554cdef class GpuArray:
0 commit comments