Skip to content

Errors inside the SDK are not reported to the callback #963

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
chrylis opened this issue Jun 21, 2024 · 2 comments
Open

Errors inside the SDK are not reported to the callback #963

chrylis opened this issue Jun 21, 2024 · 2 comments

Comments

@chrylis
Copy link

chrylis commented Jun 21, 2024

In debugging #962, I found that the error was not passed back to the callback, which prevents proper debugging in deployment. In addition to logging the error, the error should have been passed to the callback.

@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@Mohima6
Copy link

Mohima6 commented Mar 21, 2025

Root Cause:

  1. Errors were only logged inside the SDK but were not passed to the callback, preventing proper error handling and debugging.
    2)This made it difficult for developers to catch exceptions and react accordingly.

Fix Implemented:
Modified the SDK to ensure that errors are passed to the callback properly.
Before Fix: Errors were only logged and never returned to the callback. Calling an SDK function that triggers an error.
After Fix: Errors inside the SDK are now passed to the callback, not just logged.

Code to fix:

try {
someAsyncOperation(new Callback() {
@OverRide
public void onSuccess(Result result) {
callback.onSuccess(result); // Pass successful result
}

    @Override
    public void onFailure(Exception e) {
        log.error("Error occurred: " + e.getMessage(), e);  // Log error
        callback.onFailure(e);  // Now forwarding error to callback
    }
});

} catch (Exception e) {
log.error("Unhandled exception: " + e.getMessage(), e);
callback.onFailure(e); // Ensure callback receives error
}

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

No branches or pull requests

3 participants