birdofpreyru / react-native-static-server

Embedded HTTP server for React Native
https://dr.pogodin.studio/docs/react-native-static-server
Other
135 stars 21 forks source link

Unhandled promise rejections in case of failing to auto-stop (-start) the server when the app enters background / foreground #97

Closed birdofpreyru closed 7 months ago

birdofpreyru commented 7 months ago

The content of this handled should be wrapped into try / catch block, with empty catch just ignoring possible rejections if server has any attached state listeners — in that case any error will be forwarded to those listeners by .start() / .stop(), and we assume the consumer handles errors there. https://github.com/birdofpreyru/react-native-static-server/blob/38a89289ed054f781179603cd6409e998e81be25/src/index.tsx#L412-L415

If no listeners connected, we need to somehow enhance error messages, to make it clear that it is related to the auto server restart.