~tangent-org/libmemcached/1.2

« back to all changes in this revision

Viewing changes to libmemcached/error.cc

  • Committer: Brian Aker
  • Date: 2012-09-16 23:31:57 UTC
  • mfrom: (1063.1.11 libmemcached-1.0)
  • Revision ID: brian@tangent.org-20120916233157-7dvkg9rxumtl2gur
Merge staging tree to 1.0 trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
106
106
    rc= MEMCACHED_CONNECTION_FAILURE;
107
107
  }
108
108
 
 
109
  if (rc == MEMCACHED_ERRNO and local_errno == ECONNRESET)
 
110
  {
 
111
    rc= MEMCACHED_CONNECTION_FAILURE;
 
112
  }
 
113
 
109
114
  if (local_errno == EINVAL)
110
115
  {
111
116
    rc= MEMCACHED_INVALID_ARGUMENTS;
490
495
  self.error_messages= NULL;
491
496
}
492
497
 
 
498
const char *memcached_error(const memcached_st *memc)
 
499
{
 
500
  return memcached_last_error_message(memc);
 
501
}
 
502
 
493
503
const char *memcached_last_error_message(const memcached_st *memc)
494
504
{
495
 
  if (memc == NULL)
496
 
  {
497
 
    return memcached_strerror(memc, MEMCACHED_INVALID_ARGUMENTS);
498
 
  }
499
 
 
500
 
  if (memc->error_messages == NULL)
501
 
  {
 
505
  if (memc)
 
506
  {
 
507
    if (memc->error_messages)
 
508
    {
 
509
      if (memc->error_messages->size == 0)
 
510
      {
 
511
        return memc->error_messages->message;
 
512
      }
 
513
 
 
514
      return memcached_strerror(memc, memc->error_messages->rc);
 
515
    }
 
516
 
502
517
    return memcached_strerror(memc, MEMCACHED_SUCCESS);
503
518
  }
504
519
 
505
 
  if (memc->error_messages->size == 0)
506
 
  {
507
 
    return memcached_strerror(memc, memc->error_messages->rc);
508
 
  }
509
 
 
510
 
  return memc->error_messages->message;
 
520
  return memcached_strerror(memc, MEMCACHED_INVALID_ARGUMENTS);
511
521
}
512
522
 
513
523
bool memcached_has_current_error(memcached_st &memc)
529
539
 
530
540
memcached_return_t memcached_last_error(const memcached_st *memc)
531
541
{
532
 
  if (memc == NULL)
 
542
  if (memc)
533
543
  {
534
 
    return MEMCACHED_INVALID_ARGUMENTS;
535
 
  }
 
544
    if (memc->error_messages)
 
545
    {
 
546
      return memc->error_messages->rc;
 
547
    }
536
548
 
537
 
  if (memc->error_messages == NULL)
538
 
  {
539
549
    return MEMCACHED_SUCCESS;
540
550
  }
541
551
 
542
 
  return memc->error_messages->rc;
 
552
  return MEMCACHED_INVALID_ARGUMENTS;
543
553
}
544
554
 
545
555
int memcached_last_error_errno(const memcached_st *memc)