All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.src.utils.error.js Maven / Gradle / Ivy

There is a newer version: 3.14.1
Show 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 - 2024 Weber Informatics LLC | Privacy Policy