openexr_errors.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. /*
  2. ** SPDX-License-Identifier: BSD-3-Clause
  3. ** Copyright Contributors to the OpenEXR Project.
  4. */
  5. #ifndef OPENEXR_ERRORS_H
  6. #define OPENEXR_ERRORS_H
  7. #include "openexr_conf.h"
  8. #include <stdint.h>
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. /** @file */
  13. /**
  14. * @defgroup ErrorCodes Error Handling
  15. * @brief These are a group of definitions related to error handling.
  16. *
  17. * All functions in the C layer will return a result, which will
  18. * correspond to one of these codes. To ensure binary stability, the
  19. * return type is separate from the error code, and is a fixed size.
  20. *
  21. * @{
  22. */
  23. /** Error codes that may be returned by various functions. */
  24. typedef enum
  25. {
  26. EXR_ERR_SUCCESS = 0,
  27. EXR_ERR_OUT_OF_MEMORY,
  28. EXR_ERR_MISSING_CONTEXT_ARG,
  29. EXR_ERR_INVALID_ARGUMENT,
  30. EXR_ERR_ARGUMENT_OUT_OF_RANGE,
  31. EXR_ERR_FILE_ACCESS,
  32. EXR_ERR_FILE_BAD_HEADER,
  33. EXR_ERR_NOT_OPEN_READ,
  34. EXR_ERR_NOT_OPEN_WRITE,
  35. EXR_ERR_HEADER_NOT_WRITTEN,
  36. EXR_ERR_READ_IO,
  37. EXR_ERR_WRITE_IO,
  38. EXR_ERR_NAME_TOO_LONG,
  39. EXR_ERR_MISSING_REQ_ATTR,
  40. EXR_ERR_INVALID_ATTR,
  41. EXR_ERR_NO_ATTR_BY_NAME,
  42. EXR_ERR_ATTR_TYPE_MISMATCH,
  43. EXR_ERR_ATTR_SIZE_MISMATCH,
  44. EXR_ERR_SCAN_TILE_MIXEDAPI,
  45. EXR_ERR_TILE_SCAN_MIXEDAPI,
  46. EXR_ERR_MODIFY_SIZE_CHANGE,
  47. EXR_ERR_ALREADY_WROTE_ATTRS,
  48. EXR_ERR_BAD_CHUNK_LEADER,
  49. EXR_ERR_CORRUPT_CHUNK,
  50. EXR_ERR_INCORRECT_PART,
  51. EXR_ERR_INCORRECT_CHUNK,
  52. EXR_ERR_USE_SCAN_DEEP_WRITE,
  53. EXR_ERR_USE_TILE_DEEP_WRITE,
  54. EXR_ERR_USE_SCAN_NONDEEP_WRITE,
  55. EXR_ERR_USE_TILE_NONDEEP_WRITE,
  56. EXR_ERR_INVALID_SAMPLE_DATA,
  57. EXR_ERR_FEATURE_NOT_IMPLEMENTED,
  58. EXR_ERR_UNKNOWN
  59. } exr_error_code_t;
  60. /** Return type for all functions. */
  61. typedef int32_t exr_result_t;
  62. /** @brief Return a static string corresponding to the specified error code.
  63. *
  64. * The string should not be freed (it is compiled into the binary).
  65. */
  66. EXR_EXPORT const char* exr_get_default_error_message (exr_result_t code);
  67. /** @brief Return a static string corresponding to the specified error code.
  68. *
  69. * The string should not be freed (it is compiled into the binary).
  70. */
  71. EXR_EXPORT const char* exr_get_error_code_as_string (exr_result_t code);
  72. /** @} */
  73. #ifdef __cplusplus
  74. } /* extern "C" */
  75. #endif
  76. #endif /* OPENEXR_ERRORS_H */