Skip to content
This repository has been archived by the owner on Apr 27, 2022. It is now read-only.

useAppOpen generates error when Internet is not available. #36

Closed
haresh4d opened this issue Oct 5, 2021 · 12 comments
Closed

useAppOpen generates error when Internet is not available. #36

haresh4d opened this issue Oct 5, 2021 · 12 comments

Comments

@haresh4d
Copy link

haresh4d commented Oct 5, 2021

useAppOpen generates error when Internet is not available. Can someone explain how to handle such error so that app does not crash?

@zoobibackups
Copy link

{"code": 0, "message": "Error while connecting to ad server: Unable to resolve host \"googleads.g.doubleclick.net\": No address associated with hostname"}
[Tue Oct 12 2021 11:53:46.466]  WARN     Possible Unhandled Promise Rejection (id: 0):
Error: Error while connecting to ad server: Unable to resolve host "googleads.g.doubleclick.net": No address associated with hostname
promiseMethodWrapper@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2207:45
load@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:300943:43
AppOpenAd@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:300075:17
createAd@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:300101:44
http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:300573:34
commitHookEffectListMount@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:19611:38
commitPassiveHookEffects@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:19646:44
invokeGuardedCallbackImpl@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:9167:21
invokeGuardedCallback@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:9261:42
flushPassiveEffectsImpl@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:21990:36
unstable_runWithPriority@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:54964:30
performSyncWorkOnRoot@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:21115:28
performSyncWorkOnRoot@[native code]
http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:12418:38
unstable_runWithPriority@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:54964:30
flushSyncCallbackQueueImpl@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:12413:28
flushSyncCallbackQueue@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:12402:35
scheduleUpdateOnFiber@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:20755:37
updateContainer@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:23234:21
render@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:23668:24
renderApplication@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:82776:77
run@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:82346:28
runApplication@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:82399:28
__callFunction@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2741:36
http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2473:31
__guard@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2695:15
callFunctionReturnFlushedQueue@http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:2472:21
callFunctionReturnFlushedQueue@[native code]

Exactly the app crashes when no internet connection, this is the log.

@haresh4d
Copy link
Author

haresh4d commented Nov 3, 2021

@zoobibackups it is not a crash it is just a console.error message which wont be displayed in release build.

@wjaykim
Copy link
Collaborator

wjaykim commented Nov 3, 2021

Hi, as @haresh4d said, the message showed up when you handle ad load error with console.error.
You can write your own code to handle error.

@wjaykim wjaykim closed this as completed Nov 4, 2021
@zoobibackups
Copy link

zoobibackups commented Nov 25, 2021

@zoobibackups it is not a crash it is just a console.error message which wont be displayed in release build.

Hi, as @haresh4d said, the message showed up when you handle ad load error with console.error. You can write your own code to handle error.

i put this in try catch but no error log in the catch, seems that the error is not handeled by this package. console.error show nothing

@zoobibackups
Copy link

@zoobibackups it is not a crash it is just a console.error message which wont be displayed in release build.

tryCatch gives nothing in the catch.
And its own error handling also not working

@zoobibackups
Copy link

And why this issue is closed, have you provide any solution to it????

@wjaykim
Copy link
Collaborator

wjaykim commented Nov 25, 2021

You can handle error not through try catch block, but using the adLoadError value of useAppOpenAd. If the error occurs while loading ad, the adLoadError value will be set, (was undefined before error occurs), then you can skip showing ad. That is because this library does not "throws" error but providing error info through hook returns. You can read documentation.

@haresh4d
Copy link
Author

@zoobibackups use the latest version of library. It doesnt show any error there.

@zoobibackups
Copy link

@zoobibackups use the latest version of library. It doesnt show any error there.

Ok i will try, thanks!

@zoobibackups
Copy link

You can handle error not through try catch block, but using the adLoadError value of useAppOpenAd. If the error occurs while loading ad, the adLoadError value will be set, (was undefined before error occurs), then you can skip showing ad. That is because this library does not "throws" error but providing error info through hook returns. You can read documentation.

this doesnot work in previous versions let me try the new version now???

@wjaykim
Copy link
Collaborator

wjaykim commented Nov 25, 2021

Ahh, okay. Let me know if it doesn't work.

@zoobibackups
Copy link

Ahh, okay. Let me know if it doesn't work.

Yap, its working fine now, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants