code: private static int checkForError(int result)
      {
          if (exceptionsEnabled && result ==
              cusparseStatus.JCUSPARSE_STATUS_INTERNAL_ERROR)
          {
              throw new CudaException(cusparseStatus.stringFor(result));
          }
          return result;
      }
docs: If the given result is <strong>equal</strong> to
  cusparseStatus.JCUSPARSE_STATUS_INTERNAL_ERROR
  and exceptions have been enabled, this method will throw a
  CudaException with an error message that corresponds to the
  given result code. Otherwise, the given result is simply
  returned.<br />
  <br />
  This method is used for the functions that do not return
  an error code, but a constant value, like a cusparseFillMode.
  The respective functions may still return internal errors
  from the JNI part.
  
  @param result The result to check
  @return The result that was given as the parameter
  @throws CudaException If exceptions have been enabled and
  the given result code is cusparseStatus.JCUSPARSE_STATUS_INTERNAL_ERROR