vue-meteor-error-notifier
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Vue-Meteor Error Notifier

A utility for formatting error objects passed down from Meteor to the client into a user friendly notification. Supports native alert() notifications, as well as Buefy and Vue-Sweetalert2 toast notifications.

Install

npm install vue-meteor-error-notifier

Import

import Vue from 'vue';
import VueMeteorErrorNotifier from 'vue-meteor-error-notifier';
 
// Make sure this is placed after Vue.use(Buefy) or Vue.use(VueSweetalert2)
Vue.use(VueMeteorErrorNotifier, {
    notifier: 'sweetalert2' // Can be one of 'native', 'sweetalert2' or 'buefy'
});

Use

export default {
    methods: {
        someVueMethod() {
            Meteor.call('some.meteor.method', (err, resp) => {
                if (err) {
                    this.$notifyError(err); // Formats and spits out a user friendly error notification
                    return;
                }
               
                // Continue method here
            });
        }
    }
}

Notification Interfaces

Errors can be emitted using either native alert() notifications, or using a pre-existing notification library like the Toast notifications bundled with Buefy or Sweetalert's Toast notifications.

As native alert() notifications blocks the user interface until input is received from the user, I'd recommend using installing (if not already installed) either Buefy or Vue-Sweetalert2. Then specify the interface you want to use in the Vue.use() options specified above.

License

This repository is licensed under the ISC license.

Copyright (c) 2019, Jørgen Vatle.

Package Sidebar

Install

npm i vue-meteor-error-notifier

Weekly Downloads

2

Version

1.0.2

License

ISC

Unpacked Size

28.1 kB

Total Files

24

Last publish

Collaborators

  • jorgenvatle