Update paginator.js

Updated code style, added error handler, changed pattern