1 // 2 // Errors.h 3 // CoreEntitlements 4 // 5 // 6 7 #pragma once 8 9 #ifndef _CE_INDIRECT 10 #error "Please include <CoreEntitlements/CoreEntitlements.h> instead of this file" 11 #endif 12 13 /*! 14 * @typedef CEError_t 15 * A shared error type that is returned by CoreEntitlements APIs 16 */ 17 typedef const struct CEError * CEError_t; 18 19 // Macro to define the error for export; 20 #define CE_DEF_ERROR(name) extern CEError_t name; 21 22 // Returned on successful invocation 23 CE_DEF_ERROR(kCENoError); 24 25 // Returned when the library encounters API misuse 26 CE_DEF_ERROR(kCEAPIMisuse); 27 28 // Returned when an invalid argument has been passed in 29 CE_DEF_ERROR(kCEInvalidArgument); 30 31 // Returned when we expected to have allocated data, but we couldn't 32 CE_DEF_ERROR(kCEAllocationFailed); 33 34 // Returned when the passed in entitlements do not conform to any supported format 35 CE_DEF_ERROR(kCEMalformedEntitlements); 36 37 // Returned when a group of queries does not generate a valid result on the current CEQueryContext 38 CE_DEF_ERROR(kCEQueryCannotBeSatisfied); 39 40 /*! 41 * @function CEGetErrorString 42 * Returns a string that describes the error 43 */ 44 const char* CEGetErrorString(CEError_t error); 45