Comments (4)
I also get a useless stacktrace when migrating. +1 for a fix.
Up 20131015000000-create-items-table
Migrations complete
Exception in thread "main" java.sql.BatchUpdateException: Batch entry 1 was aborted. Call getNextException to see the cause.
at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2598)
at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleCommandStatus(AbstractJdbc2Statement.java:2569)
at org.postgresql.core.v3.QueryExecutorImpl.interpretCommandStatus(QueryExecutorImpl.java:2149)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1803)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:407)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2737)
at clojure.java.jdbc$execute_batch.invoke(jdbc.clj:319)
at clojure.java.jdbc$db_do_commands$fn__607.invoke(jdbc.clj:520)
at clojure.java.jdbc$db_transaction_STAR_.invoke(jdbc.clj:494)
at clojure.java.jdbc$db_do_commands.doInvoke(jdbc.clj:519)
at clojure.lang.RestFn.applyTo(RestFn.java:142)
at clojure.core$apply.invoke(core.clj:623)
at clojure.java.jdbc$db_do_commands.doInvoke(jdbc.clj:513)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invoke(core.clj:619)
at clojure.java.jdbc$do_commands.doInvoke(jdbc.clj:847)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at migratus.database$up_STAR_$fn__778.invoke(database.clj:50)
at clojure.java.jdbc$transaction_STAR_.invoke(jdbc.clj:797)
at migratus.database$up_STAR_.invoke(database.clj:44)
at clojure.lang.AFn.applyToHelper(AFn.java:167)
at clojure.lang.AFn.applyTo(AFn.java:151)
at clojure.core$apply.invoke(core.clj:617)
at robert.bruce$try_try_again$fn__763.invoke(bruce.clj:118)
at robert.bruce$retry.invoke(bruce.clj:94)
at robert.bruce$retry$fn__756.invoke(bruce.clj:109)
at clojure.core$trampoline.invoke(core.clj:5690)
at clojure.core$trampoline.doInvoke(core.clj:5695)
at clojure.lang.RestFn.invoke(RestFn.java:439)
at robert.bruce$try_try_again.doInvoke(bruce.clj:118)
at clojure.lang.RestFn.invoke(RestFn.java:482)
at migratus.database.Migration.up(database.clj:71)
at migratus.cli.CliMigration.up(cli.clj:27)
at migratus.core$up_STAR_.invoke(core.clj:37)
at migratus.core$migrate_STAR_.invoke(core.clj:44)
at migratus.core$migrate$fn__200.invoke(core.clj:57)
at migratus.core$run.invoke(core.clj:23)
at migratus.core$migrate.invoke(core.clj:57)
at user$eval222.invoke(form-init3760084357914235383.clj:1)
at clojure.lang.Compiler.eval(Compiler.java:6619)
at clojure.lang.Compiler.eval(Compiler.java:6609)
at clojure.lang.Compiler.load(Compiler.java:7064)
at clojure.lang.Compiler.loadFile(Compiler.java:7020)
at clojure.main$load_script.invoke(main.clj:294)
at clojure.main$init_opt.invoke(main.clj:299)
at clojure.main$initialize.invoke(main.clj:327)
at clojure.main$null_opt.invoke(main.clj:362)
at clojure.main$main.doInvoke(main.clj:440)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:419)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:532)
at clojure.main.main(main.java:37)
Subprocess failed
from migratus.
@yayitswei This error happens because of an error in the migration. Since no one is perfect it would really be nice if migratus would display the error instead of its current behavior, though.
I've been working around it by running any failing migrations through psql
manually (which will print out the error).
from migratus.
Migratus is designed to be used as a library. It also includes a lein plugin. Migratus is not and will not be in the business of munging exceptions as they come out of the JDBC driver. Interpreting exceptions--which ones to ignore, which ones to unwrap, which ones to pass along--should be up to the application that is using migratus.
That said, there are a couple of things that could improved here. Migratus could not do a batch execution when there is only one SQL statement to execute, which should provide the underlying exception in that case.
The CLI client could be modified to interpret the exceptions in a way that can be more nicely presented to the user.
If either of you is interested in pursuing this let me know. I don't have any guarantees as to when I could take a look at it.
from migratus.
updated to handle wrapped execptions
from migratus.
Related Issues (20)
- Database locked when attempting to run coded migration HOT 24
- `:migration-dir` paths seem to follow undocumented rules HOT 2
- Migratus running migrations already marked as ran HOT 5
- Migration fails if a comment is present on line with semicolon HOT 5
- Improve Circle CI setup HOT 2
- No method in multimethod 'make-store' for dispatch value: null when passing a hikari connection pool HOT 2
- When error happens, db password information is shown HOT 5
- next.jdbc does not support :connection-uri style :db (yet) HOT 4
- How to know current db tables state/fields? HOT 8
- Paths with "+" characters result in NoSuchFileException HOT 2
- Custom args to migration functions HOT 3
- Sanitation of migration-table-name breaks existing migrations HOT 2
- Tests failing
- Return new file name from migratus/create instead of nil HOT 6
- [BUG] up / down don't appear to be working with code-based migrations HOT 4
- Add option to list ALL migrations considered by migratus HOT 13
- Table name should be keyword for next.jdbc HOT 2
- Option to ignore regex pattern warning HOT 6
- Allow for future migrations that are not run until the timestamp on the migration has passed HOT 10
- Migratus rollback doesn't bring down the last migration, but the first migration. HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from migratus.