Handle errors

When you want catch errors from emitted events you can use onError method

/eventrix/index.js
import { Eventrix } from 'eventrix';
import receiversList from './receivers';

const initialState = {
    users: [],
};

const eventrix = new Eventrix(initialState, receiversList);

eventrix.onError((error, eventName, eventPayload, currentState) => {
    console.error(eventName, error);
})

export default eventrix;

Last updated