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

Logging invalid java migration file #2482

Closed
cdalexndr opened this issue Aug 25, 2019 · 4 comments

Comments

@cdalexndr
Copy link

@cdalexndr cdalexndr commented Aug 25, 2019

Using 'info' level logger, my java migration script is skipped, and no error is logged (what happened?!).
With 'debug' log level i get:
Skipping non-instantiable class (invocation error): db.migration.V0_1_0__java_migration

Actually, the constructor of my java migration script throws an exception, and ClassUtils catches InvocationTargetException and logs a debug mesage with no exception stack trace or message, thus the reason is missing.

I understand the reason to silently skip non java migration scripts inside 'db/migrations', but if the java class has the required name template (is a migration class) then any exceptions inside it should be logged as error/warn.

@alextercete

This comment has been minimized.

Copy link
Member

@alextercete alextercete commented Aug 27, 2019

@cdalexndr Thanks for reporting this. Just to clarify the behaviour you expected to see: would you like the command (such as Migrate) to fail with the exception that is thrown inside the constructor of the Java migration?

@cdalexndr

This comment has been minimized.

Copy link
Author

@cdalexndr cdalexndr commented Aug 27, 2019

@alextercete Yes, that would be nice.

@alextercete

This comment has been minimized.

Copy link
Member

@alextercete alextercete commented Aug 28, 2019

@cdalexndr Upon closer inspection, it looks like Flyway 6 is already adding the root cause of the invocation target exception to the debug message, so it might be just the case of promoting that to a warning or an error.

Could you please confirm that Flyway 6 in debug mode gives you the actual exception being thrown inside the constructor of your migration?

@alextercete

This comment has been minimized.

Copy link
Member

@alextercete alextercete commented Sep 10, 2019

We've decided to show that message as a warning. As of Flyway 6, it will also contain the root cause of the exception.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.