When SRI are invalid, is a Javascript detection method/API we can use to ensure the asset has loaded and that they haven't thrown an error? I have posed this question to the fine folks on StackOverflow: "Is it possible to log client-side sub-resource integrity errors with javascript?"
Use the element onerror
event handler, from there you can do some additional checks to rule
out some common errors before suggesting it might be an SRI issue. You can never be 100% that it
is an SRI issue.
This library is in development to simplify the process of monitoring SRI violations.
<script src="lib/sri-monitor.js"></script>
<script
src="https://example.com/lib/you/want/to/monitor.js"
integrity="sha256-xxxxxx"
onerror="monitorForSriError(this)" />