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

SQL errors lost in Javascript stacktrace #99

Open
1 of 6 tasks
brendanmckenzie opened this issue Nov 4, 2020 · 1 comment
Open
1 of 6 tasks

SQL errors lost in Javascript stacktrace #99

brendanmckenzie opened this issue Nov 4, 2020 · 1 comment

Comments

@brendanmckenzie
Copy link

brendanmckenzie commented Nov 4, 2020

Feature description

When running migrate watch in a rather short terminal window SQL errors are lost amongst Javascript stack traces

Motivating example

There are 10 lines of JS stack trace for 2 lines of SQL errors.

graphile-migrate: Already up to date
[2020-11-04T06:48:27.687Z]: Running current.sql

🛑 Error occurred at line 12, column 1 of "current.sql":
|   alter table taxonomy_level
|     add constraint fk_taxonomy_level_parent foreign key (parent_id, project_id, environment_id)
|       references taxonomy_level (id, project_id, environment_id);
|   asdf;
| --^
| 42601: syntax error at or near "asdf"
    error: syntax error at or near "asdf"
        at Parser.parseErrorMessage (/Users/.../node_modules/pg-protocol/dist/parser.js:278:15)
        at Parser.handlePacket (/Users/.../node_modules/pg-protocol/dist/parser.js:126:29)
        at Parser.parse (/Users/.../node_modules/pg-protocol/dist/parser.js:39:38)
        at Socket.<anonymous> (/Users/.../node_modules/pg-protocol/dist/index.js:8:42)
        at Socket.emit (node:events:327:20)
        at addChunk (node:internal/streams/readable:304:12)
        at readableAddChunk (node:internal/streams/readable:279:9)
        at Socket.Readable.push (node:internal/streams/readable:218:10)
        at TCP.onStreamRead (node:internal/stream_base_commons:192:23)

    Severity:   ERROR
    Code:       42601


Breaking changes

I feel this can be implemented without much overhead.

Supporting development

I [tick all that apply]:

  • am interested in building this feature myself
  • am interested in collaborating on building this feature
  • am willing to help testing this feature before it's released
  • am willing to write a test-driven test suite for this feature (before it exists)
  • am a Graphile sponsor ❤️
  • have an active support or consultancy contract with Graphile
@benjie
Copy link
Member

benjie commented Nov 4, 2020

I'd be open to making this an option e.g. -S,--no-stack-trace, but not all errors are as beautiful as the one you have posted in this issue, sometimes they come from other sources and the stack trace is important in those cases.

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