Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly bubble up rejected promises from TeamSync #456

Merged
merged 4 commits into from
Aug 3, 2020

Conversation

jaller94
Copy link
Contributor

@jaller94 jaller94 commented Jul 28, 2020

Floating promises could lead to uncaught errors in TeamSync

Failing user or channel syncs are currently resulting in an uncaught promise. That a deprecated functionality of Node, which will crash the end the process soon anyway and would lead to inconsistent behaviour.

.setAvatarUrl threw because Synapse doesn't like undefined

Also, .setAvatarUrl requires a string. The Element client resets the avatar by providing an empty array, so this fixes #453.

Broken counter for creating team clients

const teams = [,,];
const promiseFunctions = [];
let i = 0;
for (const team of teams) {
    i++;
    promiseFunctions.push(async() => {
        console.log(`${i} of ${teams.length}`);
    });
}
promiseFunctions.forEach(func => func());

outputs

3 of 3
3 of 3
3 of 3

because at the time the promises execute, the variable i from the outer context already has its final value 3.

@jaller94 jaller94 requested a review from a team July 28, 2020 19:22
@jaller94 jaller94 added the bug label Jul 28, 2020
@jaller94 jaller94 merged commit 4077825 into develop Aug 3, 2020
@jaller94 jaller94 deleted the j94/properly-reset-avatars branch August 4, 2020 13:23
@jaller94 jaller94 added the T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems. label May 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Uncaught promise: Call to synapse/…/avatar_url
2 participants