-
Notifications
You must be signed in to change notification settings - Fork 567
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
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
export async function rejectWhenEmptyArray(promise) { | ||
const data = await promise; | ||
if (!data || data.length === 0) { | ||
throw new InternalError('Empty data'); |
There was a problem hiding this comment.
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 👀
There was a problem hiding this comment.
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'] |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vdd, bom ponto!
- invalida resposta vazia - reorganiza arquivo de utils
1640c95
to
08a1086
Compare
Quality Gate passedIssues Measures |
Gera erro quando um provedor retorna uma lista vazia