1let isErrorHandlingEnabled = true;
2const developmentBuildMessage = `If you're trying to use a module that is not supported in Expo Go, you need to create a development build of your app. See https://docs.expo.dev/development/introduction/ for more info.`;
3function customizeUnavailableMessage(error) {
4    error.message += '\n\n' + developmentBuildMessage;
5}
6function customizeModuleIsMissingMessage(error) {
7    error.message = `Your JavaScript code tried to access a native module that doesn't exist.
8
9${developmentBuildMessage}`;
10}
11function customizeError(error) {
12    if ('code' in error && error.code === 'ERR_UNAVAILABLE') {
13        customizeUnavailableMessage(error);
14    }
15    else if (error.message.includes('Native module cannot be null') || // RN 0.64 and below message
16        error.message.includes('`new NativeEventEmitter()` requires a non-null argument.') // RN 0.65+ message
17    ) {
18        customizeModuleIsMissingMessage(error);
19    }
20}
21function errorHandler(originalHandler, error, isFatal) {
22    if (error instanceof Error) {
23        customizeError(error);
24    }
25    originalHandler(error, isFatal);
26}
27export function createErrorHandler(originalHandler) {
28    return (error, isFatal) => {
29        if (isErrorHandlingEnabled) {
30            errorHandler(originalHandler, error, isFatal);
31            return;
32        }
33        originalHandler(error, isFatal);
34    };
35}
36export function disableErrorHandling() {
37    isErrorHandlingEnabled = false;
38}
39//# sourceMappingURL=ExpoErrorManager.js.map