Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

saveProject throws an error when a network request fails

Aperta Adatta ai principianti
#4,276 3 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 3 giorni

@dyk1454683243-sudo ci sta già lavorando.

Dal 2/10/2026.

  • #2 di @dyk1454683243-sudo — chiusa senza merge
  • #4304 di @PS01K — chiusa senza merge
  • #4311 di @dyk1454683243-sudo — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
javascript
Ambito
api, frontend

Direzione di ricerca

Inizia dal punto di ingresso saveProject() e dal gestore catch di apiClient.put() mostrato nell’issue. Riproduci il fallimento facendo fallire la richiesta senza una risposta HTTP, quindi verifica che la gestione esistente del fallimento del salvataggio venga eseguita senza una rejection non gestita né un TypeError secondario.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Bug
p5.js version

2.3.2

What is your operating system?

Linux

Web browser and version

firefox 153.0.1

Actual Behavior

When saving a project, if the request fails because of a network error, saveProject() throws a TypeError instead of handling the save failure normally.
the error is:
Cannot read properties of undefined (reading 'status')
this happens because the error handler assumes error.response always exists, but for network errors there is no response.

Expected Behavior

A network error while saving should be handled as a normal save failure without throwing another error.
The user should get the usual save failure handling instead of an unhandled/rejected promise.

Steps to reproduce
Steps:
  1. open an existing saved project and make some changes.
  2. disconnect the network or otherwise make the api request fail without returning an http response.
  3. try to save the project.
  4. saveProject() rejects with:

Cannot read properties of undefined (reading 'status')

Snippet:
apiClient
  .put(`/projects/${state.project.id}`, formParams)
  .catch((error) => {
    const { response } = error;

    if (response.status === 403) {
      // ...
    }
  });

for a network error, error.response is undefined, so accessing response.status throws.
a possible fix would be to check whether response exists before accessing response.status, and handle network errors as a normal save failure.

Lingua principale
JavaScript
Stelle
1.7k
Fork
1.7k
Merge medio
3g 18h
PR unite (30g)
7

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di processing/p5.js-web-editor

Tutte le issue di processing/p5.js-web-editor

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.