I've got an svg stored in an s3 bucket and I'm embedding it on an html page using the `object` tag, like so:

```
<object type="image/svg+xml" data="url-to-svg-source" id="graph"></object>

```

Sometimes, when the browser tries to load the data from the url, it gets a 403. I'd like to notice this error and try reloading/re-rendering the svg source if it happens, but I can't tell how to notice this error. There must be a way to catch that error that I'm seeing printed in my js console in devtools. I've tried registering an eventListener "onerror", but it doesn't seem to be triggering. Maybe it's just that the error's occuring before my listener gets registered? Or maybe I'm registering it on the wrong object? 

I've tried registering a listener on `error`, like so

```
document
  .getElementById("graph")
  .addEventListener(
    "error", 
    function(){ console.log("on error") })

```

Then I triggered an error from S3 like so

```
$("#graph").attr("data", badurl)

```

But I don't see my error listener firing..