Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with long stack traces #24

Open
opike opened this issue Sep 14, 2017 · 1 comment
Open

Issue with long stack traces #24

opike opened this issue Sep 14, 2017 · 1 comment

Comments

@opike
Copy link

opike commented Sep 14, 2017

Is there a way to prevent the log stack traces from being displayed for basic error messages (e.g. "Table x already exists" ?

Error: ER_TABLE_EXISTS_ERROR: Table 'roles' already exists
    at Query.Sequence._packetToError (/Volumes/github-image/bitcoin-core/node_modules/mysql/lib/protocol/sequences/Sequence.js:52:14)
    at Query.ErrorPacket (/Volumes/github-image/bitcoin-core/node_modules/mysql/lib/protocol/sequences/Query.js:77:18)
    at Protocol._parsePacket (/Volumes/github-image/bitcoin-core/node_modules/mysql/lib/protocol/Protocol.js:279:23)
    at Parser.write (/Volumes/github-image/bitcoin-core/node_modules/mysql/lib/protocol/Parser.js:76:12)
    at Protocol.write (/Volumes/github-image/bitcoin-core/node_modules/mysql/lib/protocol/Protocol.js:39:16)
    at Socket.<anonymous> (/Volumes/github-image/bitcoin-core/node_modules/mysql/lib/Connection.js:103:28)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at TCP.onread (net.js:548:20)
    at Protocol._enqueue (/Volumes/github-image/bitcoin-core/node_modules/mysql/lib/protocol/Protocol.js:145:48)
    at Connection.query (/Volumes/github-image/bitcoin-core/node_modules/mysql/lib/Connection.js:208:25)
    at /Volumes/github-image/bitcoin-core/node_modules/db-migrate-mysql/index.js:371:29
From previous event:
    at Object.runSql (/Volumes/github-image/bitcoin-core/node_modules/db-migrate-mysql/index.js:366:12)
    at Object.createTable (/Volumes/github-image/bitcoin-core/node_modules/db-migrate-base/index.js:240:17)
    at Object.<anonymous> (/Volumes/github-image/bitcoin-core/node_modules/db-migrate/lib/driver/shadow.js:37:52)
    at runCallback (timers.js:649:20)
    at tryOnImmediate (timers.js:622:5)
    at processImmediate [as _immediateCallback] (timers.js:594:5)
From previous event:
    at Object.db.(anonymous function) [as createTable] (/Volumes/github-image/bitcoin-core/node_modules/db-migrate/lib/driver/shadow.js:36:14)
    at Class.exports.up (/Volumes/github-image/bitcoin-core/migrations/20170819024243-create-roles.js:19:13)
    at Class.<anonymous> (/Volumes/github-image/bitcoin-core/node_modules/db-migrate/lib/skeleton.js:81:41)
From previous event:
    at Class._up (/Volumes/github-image/bitcoin-core/node_modules/db-migrate/lib/skeleton.js:65:12)
    at Class.up (/Volumes/github-image/bitcoin-core/node_modules/db-migrate/lib/skeleton.js:149:17)
    at Object.up (/Volumes/github-image/bitcoin-core/node_modules/db-migrate/lib/migrator.js:112:14)
    at /Volumes/github-image/bitcoin-core/node_modules/db-migrate/lib/migrator.js:178:25
From previous event:
    at /Volumes/github-image/bitcoin-core/node_modules/db-migrate/lib/migrator.js:171:12
    at runCallback (timers.js:649:20)
    at tryOnImmediate (timers.js:622:5)
    at processImmediate [as _immediateCallback] (timers.js:594:5)
From previous event:
    at /Volumes/github-image/bitcoin-core/node_modules/db-migrate/lib/migrator.js:166:39
    at Query._callback (/Volumes/github-image/bitcoin-core/node_modules/db-migrate/lib/migration.js:373:7)
    at Query.Sequence.end (/Volumes/github-image/bitcoin-core/node_modules/mysql/lib/protocol/sequences/Sequence.js:88:24)
    at Query._handleFinalResultPacket (/Volumes/github-image/bitcoin-core/node_modules/mysql/lib/protocol/sequences/Query.js:139:8)
    at Query.EofPacket (/Volumes/github-image/bitcoin-core/node_modules/mysql/lib/protocol/sequences/Query.js:123:8)
    at Protocol._parsePacket (/Volumes/github-image/bitcoin-core/node_modules/mysql/lib/protocol/Protocol.js:279:23)
    at Parser.write (/Volumes/github-image/bitcoin-core/node_modules/mysql/lib/protocol/Parser.js:76:12)
    at Protocol.write (/Volumes/github-image/bitcoin-core/node_modules/mysql/lib/protocol/Protocol.js:39:16)
    at Socket.<anonymous> (/Volumes/github-image/bitcoin-core/node_modules/mysql/lib/Connection.js:103:28)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at TCP.onread (net.js:548:20)


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@wzrdtales
Copy link
Member

Why would you want to omit error messages? They are the most important asset you should never want to hide. I would suggest to actually fix the problem, that you have here.

For create table there is even an option to support IF NOT EXISTS though. Here is an example that is using it:

https://db-migrate.readthedocs.io/en/latest/API/SQL/#createtabletablename-columnspec-callback

However in your own interest you should fix those issues before you stumble into horrible failures while going to production that happen to you due to inconsistency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants