Skip to content

feat: Add callback for server startup failure - #1192

Merged
mykola-mokhnach merged 1 commit into
masterfrom
start-stop
Jul 30, 2026
Merged

feat: Add callback for server startup failure#1192
mykola-mokhnach merged 1 commit into
masterfrom
start-stop

Conversation

@mykola-mokhnach

Copy link
Copy Markdown

Summary

FBWebServer.startServing currently has no way to report a failure to bind the HTTP listener (e.g. every port in the configured binding range is already in use) other than calling abort(), killing the whole process with no structured error. This makes it impossible for any embedder/subclass to handle the failure gracefully (log it, retry, fail a test cleanly, etc.).

This adds an optional FBWebServerDelegate callback, webServer:didFailToStartWithError:, that is invoked with the underlying NSError when the HTTP server fails to start. If the delegate doesn't implement it, the existing abort() behavior is preserved, so this is fully backward compatible.

Changes

  • FBWebServer.h: added @optional -webServer:didFailToStartWithError: to FBWebServerDelegate; updated startServing's doc comment to describe the new contract.
  • FBWebServer.m: startHTTPServer now returns BOOL and notifies the delegate (if implemented) instead of unconditionally aborting; startServing bails out early if startup failed rather than proceeding to init the mjpeg broadcaster and enter the run loop.

@mykola-mokhnach

Copy link
Copy Markdown
Author

Linking #1183

@mykola-mokhnach
mykola-mokhnach merged commit 3a80439 into master Jul 30, 2026
44 of 45 checks passed
@mykola-mokhnach
mykola-mokhnach deleted the start-stop branch July 30, 2026 22:01
github-actions Bot pushed a commit that referenced this pull request Jul 30, 2026
## [16.1.0](v16.0.3...v16.1.0) (2026-07-30)

### Features

* Add callback for server startup failure ([#1192](#1192)) ([3a80439](3a80439))
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 16.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants