Vignesh Subramanian
Vignesh Subramanian

Reputation: 7289

capture yammer embed error

I have added yammer feed to my site

try{      
yam.connect.embedFeed(
          { container: '#embedded-feed',
            network: 'fourleaf.com',
            feedType: 'group',                // can be 'group', 'topic', or 'user'          
            feedId: '123'                     // feed ID from the instructions above
            ,config: {
                 defaultGroupId: 3257958      // specify default group id to post to 
            }
      });  
}
catch(exception ex){
//error handling code here
}  

If the user has not accepted the usage policy, yammer is throwing an error that x-frame options not enabled.

I am trying to catch this error in the catch block, but it is not getting captured in it! I can see the error in console but code inside catch block is not getting called

Or is there a success function that is available in yammer feed embedding option

Upvotes: 0

Views: 339

Answers (2)

hannad rehman
hannad rehman

Reputation: 4331

yammer embed now has event handelers. try this in your catch block or anywhere you want,

 yam.on('error', function(){
        console.error('an error occured');
 });

Upvotes: 1

JibbyJames
JibbyJames

Reputation: 78

Have you tried using the Error event listener?

yam.on('error', handleError);

Code that would be in the catch block could then be executed in the handleError function.

See https://developer.yammer.com/docs/feed-events

Upvotes: 1

Related Questions