Coder Social home page Coder Social logo

Comments (4)

yayitswei avatar yayitswei commented on May 29, 2024

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.

danlarkin avatar danlarkin commented on May 29, 2024

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

pjstadig avatar pjstadig commented on May 29, 2024

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.

yogthos avatar yogthos commented on May 29, 2024

updated to handle wrapped execptions

from migratus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.