Catch http status 500 in webview

My app has a webview for logging in over oAuth. Works ok, yet some servers return a 500 (internal server error). Any suggestions for catching these?

I was looking into <PageLoaded> but haven’t been able to detect all 500s. Some are a white page, some have a message. Is it possible to get the response.status a la fetch?

I had the same problem when experimenting with Fetch. The following code logs “Error: Internal Server Error...". oAuth should offer the same functionality.

fetch("http://httpstat.us/500")
.then(function(response) {
    if (!response.ok) {
        throw Error(response.statusText);
    }
    return response;
}).then(function(response) {
    console.log("ok");
}).catch(function(error) {
    console.log(error);
});

Thanks you for your answer, Enrico, but my question is about the <WebView> component, not using fetch.