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

Fix: data export fails if rank is undefined #81

Closed
wants to merge 2 commits into from

Conversation

EmilianoSandri
Copy link

While I was doing my first export the process failed with the following error "Error: flatten must not be empty".

An investigation revelead that it's because I didn't had my rank configured but since I don't have any recorded anarchy battle initRank.ts failed too.

As a fix I suggest to add some lines to check if user's rank state is defined, if not it warns the user then skip the process insted of trying and failing to update a non existing rank state.

emiliano@MacBook-Air-di-Emiliano ~ [1]> deno run -Ar https://raw.githubusercontent.com/spacemeowx2/s3si.ts/main/s3si.ts -e file
Error: flatten must not be empty
    at beginPoint (https://raw.githubusercontent.com/spacemeowx2/s3si.ts/main/src/RankTracker.ts:219:11)
    at generateDeltaList (https://raw.githubusercontent.com/spacemeowx2/s3si.ts/main/src/RankTracker.ts:232:36)
    at RankTracker.updateState (https://raw.githubusercontent.com/spacemeowx2/s3si.ts/main/src/RankTracker.ts:372:38)
    at eventLoopTick (ext:core/01_core.js:183:11)
    at async GameFetcher.updateRank (https://raw.githubusercontent.com/spacemeowx2/s3si.ts/main/src/GameFetcher.ts:68:24)
    at async App.exportOnce (https://raw.githubusercontent.com/spacemeowx2/s3si.ts/main/src/app.ts:282:30)
    at async App.run (https://raw.githubusercontent.com/spacemeowx2/s3si.ts/main/src/app.ts:438:7)
    at async showError (https://raw.githubusercontent.com/spacemeowx2/s3si.ts/main/src/utils.ts:75:12)
    at async https://raw.githubusercontent.com/spacemeowx2/s3si.ts/main/s3si.ts:51:1
error: Uncaught (in promise) Error: flatten must not be empty
    throw new Error("flatten must not be empty");
          ^
    at beginPoint (https://raw.githubusercontent.com/spacemeowx2/s3si.ts/main/src/RankTracker.ts:219:11)
    at generateDeltaList (https://raw.githubusercontent.com/spacemeowx2/s3si.ts/main/src/RankTracker.ts:232:36)
    at RankTracker.updateState (https://raw.githubusercontent.com/spacemeowx2/s3si.ts/main/src/RankTracker.ts:372:38)
    at eventLoopTick (ext:core/01_core.js:183:11)
    at async GameFetcher.updateRank (https://raw.githubusercontent.com/spacemeowx2/s3si.ts/main/src/GameFetcher.ts:68:24)
    at async App.exportOnce (https://raw.githubusercontent.com/spacemeowx2/s3si.ts/main/src/app.ts:282:30)
    at async App.run (https://raw.githubusercontent.com/spacemeowx2/s3si.ts/main/src/app.ts:438:7)
    at async showError (https://raw.githubusercontent.com/spacemeowx2/s3si.ts/main/src/utils.ts:75:12)
    at async https://raw.githubusercontent.com/spacemeowx2/s3si.ts/main/s3si.ts:51:1

@spacemeowx2
Copy link
Owner

Thanks for reporting the issue. But I think the best fix is to silently ignore this. Maybe some users don't need RankTracker, and every run warning will be very annoying.

@EmilianoSandri
Copy link
Author

We can merge only the first of the two commits avoiding the warning altogether, would you be interested in that or you prefer to skip on this issue altogether?

@spacemeowx2
Copy link
Owner

spacemeowx2 commented Aug 7, 2023

I think this commit should fix: 417a521

So I closed this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants