I've encountered an issue with the JavaScript code snippet below while using async/await in our ES6 project. I've observed that a 404 response code is not triggering the catch block as expected. Moreover, the .json() method is causing a console error but still doesn't redirect to the catch block. It's puzzling because any error in the try block should ideally be caught and handled by the catch block.
async getDash(projectId, projectUserId) {
try {
const events = (await this.apiHttp
.fetch(`${projectId}/users/${projectUserId}/participant-event-dash`)).json();
return events;
} catch (e) {
// fall back to local (dev testing)
return (await this.http
.fetch(`${this.appConfig.url}dist/api/query/json/partic-event-dash.json`)).json();
}
}