Computer Laboratory

tesla_util.c File Reference
#include "tesla_internal.h"
+ Include dependency graph for tesla_util.c:

Go to the source code of this file.

Functions

void tesla_die (int32_t code, const char *event)
 Call this if things go catastrophically, unrecoverably wrong. More...
 
const char * tesla_strerror (int error)
 

Function Documentation

const char* tesla_strerror ( int  error)

Definition at line 46 of file tesla_util.c.

References TESLA_ERROR_EINVAL, TESLA_ERROR_ENOENT, TESLA_ERROR_ENOMEM, TESLA_ERROR_UNKNOWN, and TESLA_SUCCESS.

47 {
48 
49  switch (error) {
50  case TESLA_SUCCESS:
51  return ("Success");
52  case TESLA_ERROR_ENOENT:
53  return ("Entry not found");
54  case TESLA_ERROR_ENOMEM:
55  return ("Insufficient memory");
56  case TESLA_ERROR_EINVAL:
57  return ("Invalid argument");
59  return ("Unknown error");
60  default:
61  return ("Invalid error code");
62  }
63 }