PageRenderTime 42ms CodeModel.GetById 12ms RepoModel.GetById 1ms app.codeStats 0ms

/src/error.h

https://bitbucket.org/drjokepu/libpx
C Header | 53 lines | 36 code | 8 blank | 9 comment | 0 complexity | b8ce5fd8fdc4b0d55d37d72f746e91e1 MD5 | raw file
  1. //
  2. // error.h
  3. // libpx
  4. //
  5. // Created by Tamas Czinege on 08/05/2012.
  6. // Copyright (c) 2012 Tamas Czinege. All rights reserved.
  7. //
  8. #ifndef libpx_error_h
  9. #define libpx_error_h
  10. #include "typedef.h"
  11. struct px_error
  12. {
  13. char *severity;
  14. char *sqlState;
  15. char *message;
  16. char *detail;
  17. char *hint;
  18. char *position;
  19. char *internal_position;
  20. char *internal_query;
  21. char *where;
  22. char *file;
  23. char *line;
  24. char *routine;
  25. };
  26. // create & delete
  27. px_error *px_error_new(const px_response *restrict response);
  28. px_error *px_error_new_custom(const char *sqlState, const char *message);
  29. px_error *px_error_new_authentication_failure();
  30. px_error *px_error_new_io_error();
  31. void px_error_delete(px_error *error);
  32. // getters
  33. const char *px_error_get_severity(const px_error *restrict error) __attribute__((pure));
  34. const char *px_error_get_sqlstate(const px_error *restrict error) __attribute__((pure));
  35. const char *px_error_get_message(const px_error *restrict error) __attribute__((pure));
  36. const char *px_error_get_detail(const px_error *restrict error) __attribute__((pure));
  37. const char *px_error_get_hint(const px_error *restrict error) __attribute__((pure));
  38. const char *px_error_get_position(const px_error *restrict error) __attribute__((pure));
  39. const char *px_error_get_internal_position(const px_error *restrict error) __attribute__((pure));
  40. const char *px_error_get_internal_query(const px_error *restrict error) __attribute__((pure));
  41. const char *px_error_get_where(const px_error *restrict error) __attribute__((pure));
  42. const char *px_error_get_file(const px_error *restrict error) __attribute__((pure));
  43. const char *px_error_get_line(const px_error *restrict error) __attribute__((pure));
  44. const char *px_error_get_routine(const px_error *restrict error) __attribute__((pure));
  45. #endif