- $reporter = new ApiImportReporter( $importer, $isUpload,
- $params['interwikisource'],
- $params['summary'] );
-
- $result = $importer->doImport();
- if ( $result instanceof WikiXmlError )
- $this->dieUsageMsg( array( 'import-xml-error',
- $result->mLine,
- $result->mColumn,
- $result->mByte . $result->mContext,
- xml_error_string( $result->mXmlError ) ) );
- else if ( WikiError::isError( $result ) )
- // This shouldn't happen
- $this->dieUsageMsg( array( 'import-unknownerror', $result->getMessage() ) );
+ }
+ $reporter = new ApiImportReporter(
+ $importer,
+ $isUpload,
+ $params['interwikisource'],
+ $params['summary']
+ );
+
+ try {
+ $importer->doImport();
+ } catch ( MWException $e ) {
+ $this->dieUsageMsg( array( 'import-unknownerror', $e->getMessage() ) );
+ }
+