davedevelopment / phpmig

Simple migrations system for php
Other
569 stars 92 forks source link

Unable to catch exceptions #123

Closed Zxurian closed 7 years ago

Zxurian commented 7 years ago

I have a particularly long running migration that fails out because of the usual "MySQL server has gone away"

I'm trying to catch the PDOExceptions for that if it does, just reconnect, however even just a basic try/catch around my code doesn't seem to be triggering my catches.

Even something as basic as


public function up(){

    try {
        causeException();
    } catch (\Exception $e) {
        var_dump($e);
        die();
    }
}

I'm getting img before any handling of the exception inside my catch block.

Is there anything from phpmig that is intercepting exceptions?

davedevelopment commented 7 years ago

Not that I am aware of... have you tried calling phpmig with -vvv, I think that should show a stack trace.

Zxurian commented 7 years ago

Just did that yesterday img

it doesn't look like the stack trace is making it back up to my actual migration code, as it's never referenced in the stack trace

davedevelopment commented 7 years ago

That looks like the adaptors SQL connection has gone away. So your migration has run successfully, but when phpmig tries to record the fact, it's db connection is no good. I'm not sure of the best way to go about fixing it.

Zxurian commented 7 years ago

oh, I hadn't even thought of that. so it's not my actual migration connection that's dissappearing, but phpmig's own connection to it's own database for tracking. That should be a relatively east fix, I'll check on it now.

Zxurian commented 7 years ago

issue resolved with #124