Skip to content

Instantly share code, notes, and snippets.

@zaverden
Last active February 26, 2024 09:58
Show Gist options
  • Save zaverden/4c0b4a7d5d4f68152a449b6b32a57822 to your computer and use it in GitHub Desktop.
Save zaverden/4c0b4a7d5d4f68152a449b6b32a57822 to your computer and use it in GitHub Desktop.
// nodejs v8.9.4
// yarn add evernote@2.0.5
const Evernote = require('evernote');
const client = new Evernote.Client({ token: 'put-your-token-here', sandbox: false });
const store = client.getNoteStore();
process.on('uncaughtException', (err) => {
console.log({ source: 'uncaughtException', err });
process.exit(1);
});
process.on('unhandledRejection', (err) => {
console.log({ source: 'unhandledRejection', err });
process.exit(1);
});
console.log('before async call');
try {
store.listNotebooks()
.then(() => console.log('success'))
.catch(() => console.log('handled async error'));
} catch(err) {
console.log('handled sync error');
}
console.log('after async call');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment