Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

350
Vistas
How do I override the error function in dropzone.js?

The default error handler in dropzone.js is as follows and contains a default error implementation as below:

https://github.com/dropzone/dropzone/blob/main/src/options.js#L4

  // Called whenever an error occurs
  // Receives `file` and `message`
  error(file, message) {
    if (file.previewElement) {
      file.previewElement.classList.add("dz-error");
      if (typeof message !== "string" && message.error) {
        message = message.error;
      }
      for (let node of file.previewElement.querySelectorAll(
        "[data-dz-errormessage]"
      )) {
        node.textContent = message;
      }
    }
  },

Unfortunately the above code has the undesirable behaviour where if the server returns a non 2xx response, the HTML of that response is displayed as an error, which is incomprehensible to end users and makes them panic.

How do I replace the above callback in such a way that the above code is removed completely at runtime?

The following does not work, most specifically a breakpoint on the code above is still hit, and the HTML error text is still present:

  let dropzone = new Dropzone(document.body, { // Make the whole body a dropzone
    url: "/upload/url", // Set the url
    previewsContainer: "#previews", // Define the container to display the previews
    uploadMultiple: true,
    autoProcessQueue: true
  });
  dropzone.on("error", (file, response, xhr) => {
    console.log("An error has occurred: " + file + response + xhr.status + xhr.statusText);
  });
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda