mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-30 21:34:07 +00:00
Fix unhandled exceptions at resources loading
This commit is contained in:
parent
9cd66846cb
commit
afaa0a70ab
|
@ -862,6 +862,8 @@ void ArticleView::openLink( QUrl const & url, QUrl const & ref,
|
||||||
|
|
||||||
if ( activeDicts )
|
if ( activeDicts )
|
||||||
for( unsigned x = 0; x < activeDicts->size(); ++x )
|
for( unsigned x = 0; x < activeDicts->size(); ++x )
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
sptr< Dictionary::DataRequest > req =
|
sptr< Dictionary::DataRequest > req =
|
||||||
(*activeDicts)[ x ]->getResource(
|
(*activeDicts)[ x ]->getResource(
|
||||||
|
@ -889,6 +891,13 @@ void ArticleView::openLink( QUrl const & url, QUrl const & ref,
|
||||||
this, SLOT( resourceDownloadFinished() ) );
|
this, SLOT( resourceDownloadFinished() ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
catch( std::exception & e )
|
||||||
|
{
|
||||||
|
emit statusBarMessage(
|
||||||
|
tr( "ERROR: %1" ).arg( e.what() ),
|
||||||
|
10000, QPixmap( ":/icons/error.png" ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1038,6 +1047,8 @@ vector< ResourceToSaveHandler * > ArticleView::saveResource( const QUrl & url, c
|
||||||
if ( activeDicts )
|
if ( activeDicts )
|
||||||
{
|
{
|
||||||
for( unsigned x = 0; x < activeDicts->size(); ++x )
|
for( unsigned x = 0; x < activeDicts->size(); ++x )
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
req = (*activeDicts)[ x ]->getResource(
|
req = (*activeDicts)[ x ]->getResource(
|
||||||
url.path().mid( 1 ).toUtf8().data() );
|
url.path().mid( 1 ).toUtf8().data() );
|
||||||
|
@ -1045,6 +1056,12 @@ vector< ResourceToSaveHandler * > ArticleView::saveResource( const QUrl & url, c
|
||||||
ResourceToSaveHandler * handler = new ResourceToSaveHandler( this, req, fileName );
|
ResourceToSaveHandler * handler = new ResourceToSaveHandler( this, req, fileName );
|
||||||
handlers.push_back( handler );
|
handlers.push_back( handler );
|
||||||
}
|
}
|
||||||
|
catch( std::exception & e )
|
||||||
|
{
|
||||||
|
qWarning( "getResource request error (%s) in \"%s\"\n", e.what(),
|
||||||
|
(*activeDicts)[ x ]->getName().c_str() );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in a new issue