Promise is already defined in ES6.
Named functions for better stacktraces.
Use make-error.
Use xdg-basedir.