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

Spravit error handling ve projektu #16

Closed
Tracked by #18
TheXer opened this issue Jun 15, 2023 · 1 comment · Fixed by #18
Closed
Tracked by #18

Spravit error handling ve projektu #16

TheXer opened this issue Jun 15, 2023 · 1 comment · Fixed by #18
Assignees
Labels
enhancement New feature or request

Comments

@TheXer
Copy link
Owner

TheXer commented Jun 15, 2023

Projekt nemá žádné pěkné formátování ohledně error handlingu. Příklad je v poll_command.py, kde error handling je řešen tímto:

        if error_handling(answers):
            return await message.edit(embed=PollEmbedBase(error_handling(answers)))

přijít ideálně na způsob, aby to bylo řešeno raise keywordem, takže ideálně takto:

    if len(answer) > Poll.MAX_OPTIONS:
        raise TooManyOptionsError(f"Zadal jsi příliš mnoho odpovědí, můžeš maximálně {Poll.MAX_OPTIONS}!")

a následně do chatu zaslalo embed s errorem.

@TheXer TheXer self-assigned this Jun 15, 2023
@TheXer TheXer added the enhancement New feature or request label Jun 15, 2023
@TheXer TheXer linked a pull request Jun 16, 2023 that will close this issue
1 task
@TheXer TheXer mentioned this issue Jun 16, 2023
1 task
TheXer added a commit that referenced this issue Jun 30, 2023
## Popis:
Spravení error handlingu z 
```py
if error_handling(answers):
            return await message.edit(embed=PollEmbedBase(error_handling(answers)))
```
na 
```py
if len(answer) > Poll.MAX_OPTIONS:
        raise TooManyOptionsError(f"Zadal jsi příliš mnoho odpovědí, můžeš maximálně {Poll.MAX_OPTIONS}!")
```        

## Proč?
Zvýšení čtitelnosti, jednodušší práce s error handlingem a přehlednost.

## Co dodělat?

- [x] #16
@TheXer
Copy link
Owner Author

TheXer commented Jun 30, 2023

Vyřešeno

@TheXer TheXer closed this as completed Jun 30, 2023
TheXer added a commit that referenced this issue Sep 3, 2023
Hlavní pull-request na to, aby se nakonec všechny věci zrecenzovaly a
byly na jednom místě, než tyto věci dáme na produkci.

Co je nového? 
- #16 
- #21 
- #23 
- #24 
- Optimalizace hlasování - #29 
- Vytvořena CI pipeline

Co dál dělat?
- Počkat, až bude PR #24 hotový, teprve pak můžeme kód otestovat a
mergnout ho.

Kdo si zaslouží dík? 
- @Martian-0007 Díky moc! :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

Successfully merging a pull request may close this issue.

1 participant