'Capture Errors From Embed/Iframe
So I'm building a React application for a client and they want me to find when a user is not authenticated, and redirect to a different site. When the user is not authenticated, the app returns the errors you see below. Apologies for the blackout, but basically the errors come from the embed itself and not my app so putting try...catch around the authentication/embedding does not work.
The code that kicks off the auth and embed process looks like this. I've simplified it to what's important and removed information about the client.
async function setupEverything(x) {
LookerEmbedSDK.init('<URL>')
await LookerEmbedSDK.createDashboardWithId(x)
.appendTo('#dashboard')
.build()
.connect()
.then(setupDashboard) // Ignore this, has nothing to do with embed.
.catch((error) => {
console.error('An unexpected error occurred', error)
})
}
Essentially the embed is in an iframe, probably the error is thrown from the iframe. Is there a way to listen to this error event given that I cannot access the code within the iFrame? Should I tell my clients it's a lost cause?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|

