react-native-efilli-sdk
Version:
Efilli SDK for React Native - Consent Management Solution
77 lines (76 loc) • 2.74 kB
JavaScript
// src/enums/ErrorType.tsx
Object.defineProperty(exports, "__esModule", { value: true });
exports.getErrorTypeMessage = exports.ErrorType = void 0;
/**
* Enumeration of possible error types that can occur in the SDK
*/
var ErrorType;
(function (ErrorType) {
/**
* Invalid message type received from the consent form
*/
ErrorType["INVALID_MESSAGE_TYPE"] = "INVALID_MESSAGE_TYPE";
/**
* Invalid message format received from the consent form
*/
ErrorType["INVALID_MESSAGE_FORMAT"] = "INVALID_MESSAGE_FORMAT";
/**
* Network request failed
*/
ErrorType["NETWORK_ERROR"] = "NETWORK_ERROR";
/**
* Storage operation failed
*/
ErrorType["STORAGE_ERROR"] = "STORAGE_ERROR";
/**
* Invalid parameters provided to SDK methods
*/
ErrorType["INVALID_PARAMETERS"] = "INVALID_PARAMETERS";
/**
* SDK not initialized properly
*/
ErrorType["NOT_INITIALIZED"] = "NOT_INITIALIZED";
/**
* SDK not fully configured with required language and URLs
*/
ErrorType["NOT_CONFIGURED"] = "NOT_CONFIGURED";
/**
* Invalid or missing URL for consent form
*/
ErrorType["INVALID_URL"] = "INVALID_URL";
/**
* Native module not available or properly linked
*/
ErrorType["NATIVE_MODULE_UNAVAILABLE"] = "NATIVE_MODULE_UNAVAILABLE";
})(ErrorType || (exports.ErrorType = ErrorType = {}));
/**
* Get a user-friendly message for an error type
* @param errorType - The error type
* @returns User-friendly error message
*/
const getErrorTypeMessage = (errorType) => {
switch (errorType) {
case ErrorType.INVALID_MESSAGE_TYPE:
return 'Invalid message type received from consent form';
case ErrorType.INVALID_MESSAGE_FORMAT:
return 'Invalid message format received from consent form';
case ErrorType.NETWORK_ERROR:
return 'Network request failed';
case ErrorType.STORAGE_ERROR:
return 'Failed to store or retrieve consent data';
case ErrorType.INVALID_PARAMETERS:
return 'Invalid parameters provided to SDK method';
case ErrorType.NOT_INITIALIZED:
return 'SDK not properly initialized';
case ErrorType.NOT_CONFIGURED:
return 'SDK not fully configured - requires language and URLs for both platforms';
case ErrorType.INVALID_URL:
return 'Invalid or missing URL for consent form';
case ErrorType.NATIVE_MODULE_UNAVAILABLE:
return 'Native WebView module not available - SDK may not be properly linked';
default:
return 'Unknown error occurred';
}
};
exports.getErrorTypeMessage = getErrorTypeMessage;
;