I have this function which will if it fails retry, and if it fails x times it should finally reject the Promise. I have implemented this as follows:
examplefunction(retries = -1) {
    return new Promise(async (resolve, reject) => {
        try {
            const url = `example.org`;
            const json = await this._sendRequest(url);
            resolve(json);
        } catch (e) {
            if( retries > 0 ) {
                return this.examplefunction(retries - 1);
            }
            else {
                reject("Unable to communicate with Server. Please try again later!");
            }
        }
    });
}
the function is beeing called like this:
backend.examplefunction(3).then(
    (json) => {
        console.log(json);
    },
    (reason) => {
        console.log.(reason);
    }
)
This code is executed in a React context, so it is also running through a babel transpilitaion.
My problem is that when it will finally reject after x retries this results in a Uncaught Promise Error:
Uncaught (in promise) Unable to communicate with Server. Please try again later!!
Could anybody explain to me why this is happening?

 
    