Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

354
Visualizações
How do I handle VueJS error handling with vue-error-boundary

Recently I came across vue-error-boundary which I like the idea of very much and would like to implement it into my own projects.

I want to use vue-error-boundary features to load a component with an error instead of crashing my app. However for some reason all I can do is get the on-error prop to work, component GETS loaded but with a warning and the App still Crushes.

For Reproduction purpose: CodeSandbox

I get following error:

Vue warn]: Unhandled error during execution of render function 
  at <ImUnstable> 
  at <VErrorBoundary on-error=fn<bound TriggerMe> fall-back= 
{render: ƒ render(), __hmrId: "6505c1f8", __file: "src/components/ContactError.vue"}
> 

CODE:

App.vue:

<template>
  <VErrorBoundary :on-error="TriggerMe" :fall-back="fallBack">
    <ImUnstable />
  </VErrorBoundary>
</template>

<script>
import { markRaw } from "vue";
import VErrorBoundary from "vue-error-boundary";
import ImUnstable from "@/components/ImUnstable.vue";
import ContactError from "@/components/ContactError";
export default {
  components: {
    ImUnstable,
    VErrorBoundary,
  },
  name: "App",
  data() {
    return {
      fallBack: markRaw(ContactError),
    };
  },
  methods: {
    TriggerMe() {
      console.log("It Triggered");
    },
  },
};
</script>

ImUnstable.vue:

<template>
  <div v-for="user in users" :key="user.id">
    <p>
      {{ user.name }}
      {{ makeLarge(user.surname) }}
      {{ user.age }}
    </p>
  </div>
</template>

<script>
export default {
  errorCaptured() {
    console.log("let me see");
  },
  data() {
    return {
      users: [
        { id: 1, name: "Luke", surname: "Skywalker", age: "22" },
        { id: 2, name: "Han", surname: {}, age: "35" },
      ],
    };
  },
  methods: {
    makeLarge(data) {
      return data.toUpperCase();
    },
  },
};
</script>

ContactError.vue:

<template>
  <div>
    <p>There was an issue obtaining contact's information.</p>
  </div>
</template>
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda