-
Notifications
You must be signed in to change notification settings - Fork 61
Description
Describe the bug
The Initialize function in unleash.go always returns immediately without reporting whether the client was initialized successfully. This makes it impossible to know if the connection to the Unleash server has failed or if the client is properly configured.
Code Reference:

// Initialize will specify the options to be used by the default client.
func Initialize(options ...ConfigOption) (err error) {
defaultClient, err = NewClient(options...)
return
}
As seen above, the function directly returns without checking or surfacing connection errors. For example, if the client fails to connect or initialize properly, the error is not clearly handled or propagated to the caller.
Expected Behavior:
The Initialize function should validate the connection to the Unleash server and return a meaningful error if initialization fails. This way, developers can handle connection issues gracefully.
Actual Behavior:
The function always returns immediately, leaving the caller uncertain whether the client was successfully initialized or not.
Suggested Fix:
Update Initialize to propagate errors from NewClient.
Steps to reproduce the bug
Call Initialize() with incorrect or invalid configuration.
Observe that the method returns without any clear error about connection failure.
Subsequent calls to IsEnabled rely on fallback behavior or returns false.
Expected behavior
The Initialize function should validate the connection to the Unleash server and return a meaningful error if initialization fails. This way, developers can handle connection issues gracefully.
Logs, error output, etc.
Screenshots
No response
Additional context
No response
Unleash version
v5
Subscription type
None
Hosting type
None
SDK information (language and version)
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status