Skip to content
Snippets Groups Projects

feat: Adding ErrorCatcher and ErrorStore

Merged Viktor Gunnar Grevskott requested to merge ErrorCatcher into main
9 files
+ 232
2
Compare changes
  • Side-by-side
  • Inline
Files
9
 
<template>
 
<error-box :error-message="errorStore.getFirstError" @update:errorMessage="errorStore.removeCurrentError" />
 
<slot />
 
</template>
 
 
<script setup lang="ts">
 
import { onErrorCaptured } from 'vue';
 
import { useErrorStore } from '@/stores/ErrorStore';
 
import ErrorBox from '@/components/Exceptions/ErrorBox.vue';
 
import handleUnknownError from '@/components/Exceptions/unkownErrorHandler';
 
 
const errorStore = useErrorStore();
 
 
onErrorCaptured((err, _vm, _info): boolean => {
 
const message = handleUnknownError(err.message);
 
errorStore.addError(message); //If no openAPI axios error, use err.message
 
return false;
 
});
 
</script>
 
\ No newline at end of file
Loading