Debug: Agregar plugin de error handler y más logging
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m5s

- Crear plugin error-handler.ts para capturar todos los errores
- Captura errores de app:error, vue:error y errorHandler
- Agregar logs en script setup de componentes
- Logs antes y después de llamar a useLotes()
- Esto nos mostrará exactamente dónde crashea la app
This commit is contained in:
2025-11-21 23:42:08 -06:00
parent b0b179d945
commit bd31838139
3 changed files with 29 additions and 2 deletions

View File

@@ -103,6 +103,8 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Lote } from '~/composables/useLotes' import type { Lote } from '~/composables/useLotes'
console.log('🟢 LotesTable: <script setup> ejecutándose')
const emit = defineEmits<{ const emit = defineEmits<{
create: [] create: []
view: [lote: Lote] view: [lote: Lote]
@@ -110,7 +112,9 @@ const emit = defineEmits<{
trazabilidad: [lote: Lote] trazabilidad: [lote: Lote]
}>() }>()
console.log('🟢 LotesTable: Llamando a useLotes()...')
const { fetchLotes, TIPOS_LOTE } = useLotes() const { fetchLotes, TIPOS_LOTE } = useLotes()
console.log('🟢 LotesTable: useLotes() completado')
const lotes = ref<Lote[]>([]) const lotes = ref<Lote[]>([])
const loading = ref(false) const loading = ref(false)

View File

@@ -80,15 +80,16 @@
<script setup lang="ts"> <script setup lang="ts">
import type { Operacion } from '~/composables/useLotes' import type { Operacion } from '~/composables/useLotes'
console.log('🟡 OperacionesTable: Script ejecutado') console.log('🟡 OperacionesTable: <script setup> ejecutándose')
const emit = defineEmits<{ const emit = defineEmits<{
create: [] create: []
view: [operacion: Operacion] view: [operacion: Operacion]
}>() }>()
console.log('🟡 OperacionesTable: Llamando a useLotes()...')
const { fetchOperaciones, TIPOS_OPERACION } = useLotes() const { fetchOperaciones, TIPOS_OPERACION } = useLotes()
console.log('🟡 OperacionesTable: Composable cargado') console.log('🟡 OperacionesTable: useLotes() completado, TIPOS_OPERACION:', TIPOS_OPERACION?.length)
const operaciones = ref<Operacion[]>([]) const operaciones = ref<Operacion[]>([])
const loading = ref(false) const loading = ref(false)

View File

@@ -0,0 +1,22 @@
export default defineNuxtPlugin((nuxtApp) => {
nuxtApp.hook('app:error', (error) => {
console.error('❌❌❌ ERROR DE APLICACIÓN CAPTURADO:', error)
console.error('❌ Mensaje:', error.message)
console.error('❌ Stack:', error.stack)
console.error('❌ Causa:', error.cause)
})
nuxtApp.hook('vue:error', (error, instance, info) => {
console.error('❌❌❌ ERROR DE VUE CAPTURADO:', error)
console.error('❌ Info:', info)
console.error('❌ Componente:', instance?.$options?.name || instance?.$options?.__name)
console.error('❌ Stack:', error.stack)
})
nuxtApp.vueApp.config.errorHandler = (error, instance, info) => {
console.error('❌❌❌ ERROR HANDLER VUE:', error)
console.error('❌ Info:', info)
console.error('❌ Mensaje:', error.message)
console.error('❌ Stack:', error.stack)
}
})