Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

350
Views
Traté de manejar un error de Axios. No funciona, ¿cómo manejarlo correctamente?

Estoy creando un bot de Discord, ahora estoy trabajando en comandos que interactúan con la API de Geometry Dash. Estoy usando axios para obtener la información del nivel, y cuando escribo la ID existente, obtengo el resultado correcto y funcional. Pero si escribo la identificación incorrecta, obtengo un error -1 . Traté de manejar este error, pero nada funciona. ¿Qué tengo que hacer?

 const axios = require("axios"); exports.run = (client, message, args) => { const id = args[0]; axios.get(`https://gdbrowser.com/api/level/${id}`).then((response) => { try { const { data } = response; const { name, id, description, author, difficulty, downloads, length, stars, orbs, diamonds, featured, epic, gameVersion, version, coins, verifiedCoins, starsRequested, ldm, objects } = data; message.channel.send(`Name: ${name}\nID: ${id}\nDesc: ${description}\nAuthor: ${author}\nDifficulty: ${difficulty}\nDownloads: ${downloads}\nLength: ${length}\nStars: ${stars}\nOrbs: ${orbs}\nDiamonds: ${diamonds}\nFeatured: ${featured}\nEpic: ${epic}\nGame Ver: ${gameVersion}\nVersion: ${version}\nCoins: ${coins}\nVerified Coins: ${verifiedCoins}\nStarsReq: ${starsRequested}\nLDM: ${ldm}\nObjects: ${objects}`) } catch (e) { if(data === -1) { return; } } }) }
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Ya lo arreglé. -1 fue el error.response.data .

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!