package.src.utils.error.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of alpinejs Show documentation
Show all versions of alpinejs Show documentation
The rugged, minimal JavaScript framework
The newest version!
export function tryCatch(el, expression, callback, ...args) {
try {
return callback(...args)
} catch (e) {
handleError( e, el, expression )
}
}
export function handleError(error , el, expression = undefined) {
error = Object.assign(
error ?? { message: 'No error message given.' },
{ el, expression } )
console.warn(`Alpine Expression Error: ${error.message}\n\n${ expression ? 'Expression: \"' + expression + '\"\n\n' : '' }`, el)
setTimeout( () => { throw error }, 0 )
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy