Related to #8115
When the user tries to connect a Facebook account with no pages to their site the app displays meaningful error with explanation why it can't connect to the account.
When the user tries to connect a Facebook account with no pages to their site the app displays generic error which isn't very helpful.
Notes
I think the issue is on the following line -> we don't show the chooser dialog when there is exactly one connection and we assume this connection will work. However, if this is a User Profile connection and the service (such as Facebook) doesn't support other than external connections, it'll fail with meaningless error message.
I think we should modify the check to if (... || jsonConnectionList.length() == 0) and here propagate a specific error to the UI and show a meaningful message.
cc @kwonye
That sounds like a great solution, @malinajirka. If I recall correctly I thought we didn't get a profile back at all if there was no pages. Looks like that's not the case.
Tested and confirmed (11s) using WPAndroid alpha-156 (12.0 alpha) on Pixel 3 Android 9. In my case I tested with a Facebook account that has a Page that is unpublished in Facebook > Page > Settings > General > Page Visibility (screenshot).
I couldn't get the app logs to save for some reason (or I missed them) but I caught a screenshot:

This came up again in 12.3 beta testing. I found that I was unable to connect Facebook or LinkedIn鈥攖he result was the same for each: "An error occurred". My test Facebook account does have a Page but it is unpublished (screenshot).
Video: 4m39s

Tested with WPAndroid alpha-168 on Pixel 3 Android 9 on architectural-worm.wordpress.com Jetpack (and also other sites).
app-log-to-connect-LinkedIn-and-Facebook-sharing-services.txt
71 - [May-03 01:54 SHARING] publicize service > created
72 - [May-03 01:54 SHARING] publicize service > destroyed
73 - [May-03 01:54 SHARING] null
74 - [May-03 01:54 SHARING] StackTrace: com.android.volley.ServerError
at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:179)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:114)
75 - [May-03 01:54 UTILS] App goes to background
76 - [May-03 01:54 MAIN] ConnectionChangeReceiver successfully unregistered
77 - [May-03 01:55 UTILS] App comes from background
(internal reference: p5T066-Pl-p2)
Here is a ticket with a user experiencing this issue. Getting more info from the user to understand the issue 2047729-zen.
@osullivanchris 2047729-zen mentions a different case because they are trying to connect a Facebook account with a page whereas this bug is about trying to connect a Facebook account with no pages. If you can open a new issue with a quick list of steps to reproduce then I will check it out!
The LinkedIn failure does not seem to be related to the Facebook error. I created a separate issue for it: https://github.com/wordpress-mobile/WordPress-Android/issues/10252.