Skip to content

Commit 90ddb8d

Browse files
authored
Re throw the error when the encoding is correct but the import query failed #16
Re throw the error when the encoding is correct but the import query failed
2 parents 83be865 + 88994e9 commit 90ddb8d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/Import.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,12 @@ protected function execute_statements( $import_file ) {
6161
$converted_statement = mb_convert_encoding( $statement, 'UTF-8', $detected_encoding );
6262
echo 'Converted ecoding for statement: ' . $converted_statement . PHP_EOL;
6363
$this->driver->query( $converted_statement );
64+
} else {
65+
// It's not an encoding issue, so rethrow the exception.
66+
throw $e;
6467
}
6568
} catch ( Exception $e ) {
66-
WP_CLI::warning( 'Could not execute statement: ' . $statement );
69+
WP_CLI::error( 'Could not execute statement: ' . $statement );
6770
echo $e->getMessage();
6871
}
6972
}

0 commit comments

Comments
 (0)