e2e Tests fail due to 404, but 404 is expected

I have a small Angular 8 method, where I read a local file. However, it is possible, that the file does not exist, which is fine. Unfortunately, my Protractor e2e tests fail:

Entry({ level: SEVERE, message: ‘http://localhost:4200/assets/details.txt – Failed to load resource: the server responded with a (…)

The method in question:

const headers = new HttpHeaders().set('Content-Type', 'text/plain; charset=utf-8');

this.http.get('assets/commit_details.txt', { headers, responseType: 'text' }).subscribe((data) => {
    (...)
}, (error) => {
    return throwError(`Commit Info: ${error.statusText}`);
});

In order for the tests to pass, I could of course adjust the Protractor settings, but that seems wrong.

How would I “allow” a missing file in my method?

Source: New feed
Source Url e2e Tests fail due to 404, but 404 is expected