Skip to content

Commit 3990069

Browse files
sejasclaude
andcommitted
fix: include exception message in import error output
WP_CLI::error() exits the process immediately, so the subsequent echo $e->getMessage() line was dead code that never executed. This meant the actual SQL error details were never shown to users. Now includes the exception message in the WP_CLI::error() call so users can see what specifically went wrong (e.g., "syntax error near X"). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent fcc0898 commit 3990069

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎src/Import.php‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ protected function execute_statements( $import_file ) {
8484
throw $e;
8585
}
8686
} catch ( Exception $e ) {
87-
WP_CLI::error( 'Could not execute statement: ' . $statement );
88-
echo $e->getMessage();
87+
WP_CLI::error( 'Could not execute statement: ' . $statement . '. Error: ' . $e->getMessage() );
8988
}
9089
}
9190
}

0 commit comments

Comments
 (0)