Skip to content

Instantly share code, notes, and snippets.

View thachpv91's full-sized avatar

Phan Văn Thạch thachpv91

  • BAP
  • Đà Nẵng, Việt Nam
View GitHub Profile
@thachpv91
thachpv91 / repeat-promise.js
Created January 30, 2018 07:40 — forked from gyandeeps/repeat-promise.js
Keep calling a promise every n sec until resolved
let i = 0;
const test = () => new Promise((resolve, reject) => {
i++;
console.log(`Promise called - ${i}`);
if (i === 5) {
resolve();
}

Here's how you could create custom error classes in Node.js using latest ES6 / ES2015 syntax.

I've tried to make it as lean and unobtrusive as possible.

Defining our own base class for errors

errors/AppError.js