nanohttp-error.h File Reference

Go to the source code of this file.

Defines

#define H_OK   0
#define GENERAL_ERROR   1400
#define GENERAL_INVALID_PARAM   (GENERAL_ERROR + 1)
#define GENERAL_HEADER_PARSE_ERROR   (GENERAL_ERROR + 2)
#define THREAD_ERROR   1500
#define THREAD_BEGIN_ERROR   (THREAD_ERROR)
#define FILE_ERROR   8000
#define FILE_ERROR_OPEN   (FILE_ERROR + 1)
#define FILE_ERROR_READ   (FILE_ERROR + 2)

Typedefs

typedef void * herror_t

Functions

herror_t herror_new (const char *func, int errcode, const char *format,...)
int herror_code (herror_t err)
const char * herror_func (herror_t err)
const char * herror_message (herror_t err)
void herror_release (herror_t err)


Detailed Description

nanoHTTP error handling

Almost all function will return a "herror_t" object. If the function returns with success this object is H_OK. Another herror_t object will be returned otherwise. Following functions can be used with a returned herror_t object:

Example:

 herror_t err;

 if ((err = http_client_invoke("http://somewhere")) != H_OK)
 {
   printf("Message: %s\n", herror_message(err));
   printf("Error code: %d\n", herror_code(err));
   printf("In function: %s\n", herror_func(err));
   herror_release(err);
 }

Note that you MUST call herror_release() to free the resources.


Define Documentation

#define FILE_ERROR   8000
 

File errors

#define FILE_ERROR_OPEN   (FILE_ERROR + 1)
 

#define FILE_ERROR_READ   (FILE_ERROR + 2)
 

#define GENERAL_ERROR   1400
 

General errors

#define GENERAL_HEADER_PARSE_ERROR   (GENERAL_ERROR + 2)
 

#define GENERAL_INVALID_PARAM   (GENERAL_ERROR + 1)
 

#define H_OK   0
 

Success flag

#define THREAD_BEGIN_ERROR   (THREAD_ERROR)
 

#define THREAD_ERROR   1500
 

Thread errors


Typedef Documentation

typedef void* herror_t
 

Todo:
Remove me.
Dummy deklaration to hide the implementation.


Function Documentation

int herror_code herror_t  err  ) 
 

Returns the code of the error.

const char* herror_func herror_t  err  ) 
 

Returns the name of the function, where the error was produced.

const char* herror_message herror_t  err  ) 
 

Returns the error message.

herror_t herror_new const char *  func,
int  errcode,
const char *  format,
  ...
 

Creates a new error structure.

See also:
printf

void herror_release herror_t  err  ) 
 

Frees the error structure.


Generated on Thu Jan 25 23:36:00 2007 for csoap by  doxygen 1.4.6