Skip to content

Commit

Permalink
Merge pull request aws-amplify#3864 from elorzafe/fix-pubsub-appsyncp…
Browse files Browse the repository at this point in the history
…rovider

fix(@aws-amplify/pubsub): sending connection error  to observable on …
  • Loading branch information
elorzafe authored Aug 17, 2019
2 parents 7f09c03 + 6a483a8 commit ece0b22
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions packages/pubsub/src/Providers/AWSAppSyncProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,17 @@ export class AWSAppSyncProvider extends MqttOverWSProvider {
// reconnect everything we have in the map
await Promise.all(map.map(async ([clientId, { url, topics }]) => {
// connect to new client
const client = await this.connect(clientId, {
clientId,
url,
});
let client = null;
try {
client = await this.connect(clientId, {
clientId,
url,
});
} catch (err) {
observer.error({ message: 'Failed to connect', error: err });
observer.complete();
return undefined;
}

// subscribe to all topics for this client
// store topic-client mapping
Expand Down

0 comments on commit ece0b22

Please sign in to comment.