Skip to content

Issue with long stack traces #24

Open

Description

@opike

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.

Activity

  1. wzrdtales commented on Sep 15, 2017

    @wzrdtales
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions