Skip to content

Commit

Permalink
catch possible errors from starting the proxy or finishing proxy setup
Browse files Browse the repository at this point in the history
  • Loading branch information
sharon-wang committed Oct 10, 2024
1 parent 7cea0b1 commit 4d64ff0
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions extensions/positron-proxy/src/positronProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,11 +334,21 @@ export class PositronProxy implements Disposable {
}

// We don't have an existing proxy server for the target origin, so start a new one.
this.startNewProxyServer(contentRewriter).then(({ externalUri, finishProxySetup }) => {
finishProxySetup(targetOrigin).then(() => {
resolve(externalUri.toString());
this.startNewProxyServer(contentRewriter)
.then(({ externalUri, finishProxySetup }) => {
finishProxySetup(targetOrigin)
.then(() => {
resolve(externalUri.toString());
})
.catch(error => {
console.error(`Failed to finish setting up the proxy server at ${externalUri} for target: ${targetOrigin}.`);
reject(error);
});
})
.catch(error => {
console.error(`Failed to start the proxy server for ${targetOrigin}.`);
reject(error);
});
});
});
}

Expand Down

0 comments on commit 4d64ff0

Please sign in to comment.