Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

Tons of errors are ignored

Aberta
#2,852 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 2 dias

@curforever já está trabalhando nisso.

Desde 9/10/2026.

  • #2871 de @curforever — aberto

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
48/100
Tipo de issue
Bug
Clareza
Razoavelmente clara
Status de atividade
Ativa
Stack de tecnologia
react-native, typescript
Domínio
cli

Direção de pesquisa

Comece com isPackagerRunning.ts e rastreie cada try/catch aninhado em torno de fetch, dos dados da resposta e dos headers. Compare os casos relatados de dados undefined e de erros inesperados com os resultados pretendidos running, not_running e unrecognized. A tarefa estará concluída quando os erros não forem mais ignorados silenciosamente nem interpretados incorretamente, e o comportamento ficar visível onde a issue exigir.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

Hello. This bug is to keep track of a multitude of small issues where errors are silently ignored or misinterpreted. There are several pull requests fixing some of them already but this one does not appear to have a PR yet and is a great example. From isPackagerRunning.ts:

async function isPackagerRunning(
  packagerPort: string | number = process.env.RCT_METRO_PORT || '8081',
): Promise<
  | {
      status: 'running';
      root: string;
    }
  | 'not_running'
  | 'unrecognized'
> {
  try {
    const {data, headers} = await fetch(
      `http://localhost:${packagerPort}/status`,
    );

    try {
      if (data === 'packager-status:running') {
        return {
          status: 'running',
          root: headers.get('X-React-Native-Project-Root') ?? '',
        };
      }
    } catch (_error) {
      return 'unrecognized';
    }
    return 'unrecognized';
  } catch (_error) {
    return 'not_running';
  }
}

Two issues here had me chasing false starts with another bug:

  • Any error interpreting the data (e.g. data is undefined) is treated as undefined. This will likely be wrong so at minimum there should be a visible by default warning in this scenario
  • Any issue during this entire process that isn't explicitly handles is treated as not_running. Again this might be ok if the unrecognized error were visible, since that will not always be the correct thing to do

Bit of a side note with this snippet, there is a lot of unnecessary complexity that stems from the strange shape of this methods return type. We might want to make it something like

{status: 'running' | 'not_running' | 'unrecognized', root: string?} 

and/or use an enum for the status. This is just "bug prone" not itself a bug, and we would need to refractor this area anyway, so let me know if we feel like this should be its own bug or if we should ignore it.

Linguagem predominante
TypeScript
Estrelas
2.9k
Forks
950
Merge médio
10d 19h
PRs com merge (30d)
1

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de react-native-community/cli

Todas as issues de react-native-community/cli

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.