Cannot intercept raised exception

22 views
Skip to first unread message

Aleksander Świtalski

unread,
Jul 26, 2014, 9:23:18 AM7/26/14
to gcm-for-chr...@googlegroups.com
Hi,

I've noticed that in Chrome 36 when I call chrome.pushMessaging.getChannelId when not signed-in to Chrome an exception is raised (previously the callback was called with empty channel id).
I tried to catch and handle the exception by using try-catch block, but it is ignored and exception is thrown anyway:

Unchecked runtime.lastError while running pushMessaging.getChannelId: The user is not signed in.

Has anybody experienced such problem? My Chrome version is 36.0.1985.125.

Cheers.
Alex

Filip Gorski

unread,
Jul 27, 2014, 12:07:56 AM7/27/14
to gcm-for-chr...@googlegroups.com
Hi, Aleksander,

I don't want to speculate on the structure of your code, but it would be easier to answer your question, if you provided a snippet.
In general, some errors are returned inside of the callback in runtime.lastError, and it should be the first thing you checkin the callback.

Second, if you are implementing a new application using push messaging in Chrome, please take a look at chrome.gcm API: https://developer.chrome.com/extensions/gcm, as pretty soon chrome.pushMessaging is not going to be supported.
If you have existing application we can help you make the conversion.

Finally, if you are looking to learn if the user is signed in or not at a given point in time, please refer to the chrome.identity API: https://developer.chrome.com/extensions/identity.

Thanks.
Filip

Aleksander Świtalski

unread,
Jul 29, 2014, 3:46:03 AM7/29/14
to gcm-for-chr...@googlegroups.com
Thanks for the very useful information. I reckon that using the Identity API will solve my problem.
Reply all
Reply to author
Forward
0 new messages