I have a promise:
return this.credentialFetch(url.href, {
method: 'get',
signal: abort.signal,
headers: jsonHeaders,
})
.then((res) => {
if (res.ok) return res.json();
})
.catch(catchRequestError(res, this.globalService));
And function that is called when error occurs:
export function catchRequestError<T>(result: T, globalService: GlobalService) {
globalService.emitHttpResponse(result);
}
I get this error:
Argument of type 'void' is not assignable to parameter of type '(reason: any) => PromiseLike<never>'.
On the line:
.catch(catchRequestError(res, this.globalService));
How to handle promise error?