tj / node-migrate

Abstract migration framework for node
MIT License
1.54k stars 224 forks source link

Promise rejections swallow stack traces #158

Open hdon opened 5 years ago

hdon commented 5 years ago

Note: The title of this issue has changed

hdon@ubuntu-s-1vcpu-1gb-sfo2-01:~$ mkdir migrate-project
hdon@ubuntu-s-1vcpu-1gb-sfo2-01:~$ cd migrate-project/
hdon@ubuntu-s-1vcpu-1gb-sfo2-01:~/migrate-project$ npm i migrate
npm WARN saveError ENOENT: no such file or directory, open '/home/hdon/migrate-project/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/home/hdon/migrate-project/package.json'
npm WARN migrate-project No description
npm WARN migrate-project No repository field.
npm WARN migrate-project No README data
npm WARN migrate-project No license field.

+ migrate@1.6.2
added 20 packages from 13 contributors and audited 21 packages in 0.948s
found 0 vulnerabilities

hdon@ubuntu-s-1vcpu-1gb-sfo2-01:~/migrate-project$ ./node_modules/.bin/migrate init
  migrations dir : /home/hdon/migrate-project/migrations
hdon@ubuntu-s-1vcpu-1gb-sfo2-01:~/migrate-project$ ./node_modules/.bin/migrate create a
  create : /home/hdon/migrate-project/migrations/1558494641607-a.js
hdon@ubuntu-s-1vcpu-1gb-sfo2-01:~/migrate-project$ cat > migrations/1558494641607-a.js
exports.up = function foobar() { return Promise.reject('yay!') }
exports.down = () => Promise.resolve()
hdon@ubuntu-s-1vcpu-1gb-sfo2-01:~/migrate-project$ ./node_modules/.bin/migrate up
  up : 1558494641607-a.js
  error : yay!

Is there a debug switch to get a stack trace? I tend to think they're useful...

wesleytodd commented 5 years ago

Yep, I want to refactor the logging. The original way was preserved mostly intact for the 1.0 release, and I think that was a mistake. Maybe I can set aside some time soon to put together a 2.0 to change the logging. I will leave this open until we can resolve that.