Repository navigation
Error Handling
Balthazar edited this page Sep 30, 2026
·
2 revisions
How errors are reported, and how to tell them apart.
Errors arrive through the error event (scan and resolve failures) and as promise rejections (publishService, unpublishService, checkLocalNetworkAccess). Both have the same shape:
zeroconf.on('error', error => {
// error.message, error.code, error.domain, error.serviceName
if (error.domain === 'DNSSD' && error.code === -65555) {
// iOS: the service type is missing from NSBonjourServices
} else if (error.domain === 'DNSSD' && error.code === -65570) {
// iOS: Local Network access denied
} else if (error.domain === 'RNZeroconf' && error.code === 'TIMEOUT') {
// iOS: could not resolve error.serviceName in time
}
})Add an
errorlistener. Native errors are only emitted to JavaScript when at least oneerrorlistener is registered.
The full list of domains and codes is in the API Reference.
See the API Reference for every option, event and error code.
Documentation for react-native-zeroconf 0.17. Found a mistake? Open an issue. | Home | API Reference | Troubleshooting