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

bugfix: lista uf vazia #611

Merged
merged 2 commits into from May 17, 2024
Merged

Conversation

LorhanSohaky
Copy link
Member

Gera erro quando um provedor retorna uma lista vazia

Copy link

vercel bot commented May 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
brasilapi ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 14, 2024 7:59pm

@LorhanSohaky
Copy link
Member Author

close #607 #600

export async function rejectWhenEmptyArray(promise) {
const data = await promise;
if (!data || data.length === 0) {
throw new InternalError('Empty data');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To um pouco na dúvida se isso deveria ser um internal error nesse ponto do código mesmo ou lidar com isso lá na ponta na hora de lidar com a resposta 👀

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coloquei aqui para evitar duplicação de código, mas se tiver alguma outra ideia estou aberto a sugestões

const getData = async (uf, argsProviders = null) => {
const providers =
!argsProviders || argsProviders.length === 0
? ['dados-abertos-br', 'gov']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A gnt tirou o gov com o getConties de propósito do default?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Na verdade, tirei o da wikipedia como default. Se não me engano esse era o que mais dava problema por vir informação incompleta

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vdd, bom ponto!

Copy link

sonarcloud bot commented May 14, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

@lucianopf lucianopf merged commit 4332f4f into BrasilAPI:main May 17, 2024
3 of 4 checks passed
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.

None yet

4 participants