Capture resource errors with javascript

I am trying to log resource errors such as missing images via Sentry. I’ve got a basic html page with some non-framework javascript.

	<script src="" integrity="sha384-wF7Jc4ZlWVxe/L8Ji3hOIBeTgo/HwFuaeEfjGmS3EXAG7Y+7Kjjr91gJpJtr+PAT" crossorigin="anonymous"></script>
<script src=""></script>
		dsn: '',
		integrations: [
			new Sentry.Integrations.CaptureConsole({
				levels: ['error']

Using the above I am able to get javascript errors and console message. If I create an img tag with an invalid src, this will show a 404 on the network tab, how can I send that through to Sentry?

Is it even possible to capture this and log it?