numtel / meteor-mysql-server

Package to run MySQL server inside your Meteor app
34 stars 2 forks source link

Bad behavior when the initialize sql file contains syntax errors #7

Open robturtle opened 8 years ago

robturtle commented 8 years ago

Whenever the initialize sql file contains errors, the thrown error is useless and stop the meteor to quit gracefully. The error message is like this:

Error: Couldn't parse stack frame: '    --------------------'
    at /tools/utils/parse-stack.js:147:11
    at Array.forEach (native)
    at parseStackFrames (/tools/utils/parse-stack.js:86:10)
    at Object.parse (/tools/utils/parse-stack.js:46:23)
    at Object.exception (/tools/utils/buildmessage.js:497:29)
    at /tools/isobuild/compiler.js:614:20
    at Array.forEach (native)
    at /tools/isobuild/compiler.js:487:21
    at /tools/isobuild/compiler.js:177:28
    at Object.withCache (/tools/fs/files.js:1445:12)
    at /tools/isobuild/compiler.js:176:11
    at Array.forEach (native)
    at Function._.each._.forEach (/Users/yangliu/.meteor/packages/meteor-tool/.1.3.5_1.656zhu++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/lib/node_modules/underscore/underscore.js:79:11)
    at Object.compile (/tools/isobuild/compiler.js:171:5)
    at /tools/isobuild/bundler.js:2582:24
    at /tools/utils/buildmessage.js:271:13
    at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
    at /tools/utils/buildmessage.js:264:29
    at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
    at /tools/utils/buildmessage.js:262:18
    at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
    at /tools/utils/buildmessage.js:253:23
    at [object Object].withValue (/tools/utils/fiber-helpers.js:89:14)
    at Object.capture (/tools/utils/buildmessage.js:252:19)
    at bundle (/tools/isobuild/bundler.js:2525:31)
    at /tools/isobuild/bundler.js:2472:32
    at Object.withCache (/tools/fs/files.js:1445:12)
    at Object.exports.bundle (/tools/isobuild/bundler.js:2472:16)
    at /tools/runners/run-app.js:591:36
    at Function.run (/tools/tool-env/profile.js:489:12)
    at bundleApp (/tools/runners/run-app.js:581:34)
    at AppRunner._runOnce (/tools/runners/run-app.js:634:35)
    at AppRunner._fiber (/tools/runners/run-app.js:887:28)
    at /tools/runners/run-app.js:411:12

The error object that cause this is like:

{ [Error: ER_PARSE_ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CRE' at line 1]
  code: 'ER_PARSE_ERROR',
  errno: 1064,
  sqlState: '42000',
  index: 0 }

I strongly suggest this plugin provide a better error handling such as displaying the sql error message and let meteor quit normally.