forked from mia/Aegisub
Make AssFile::Load catch agi::Exception and report it properly. The catching of reading/parsing errors probably doesn't really belong there, but just making things work for now. Updates #1213 in preparation for the actual patch.
Originally committed to SVN as r4555.
This commit is contained in:
parent
363198b2fa
commit
5bd0981a72
1 changed files with 7 additions and 4 deletions
|
@ -72,7 +72,7 @@ AssFile::~AssFile() {
|
|||
}
|
||||
|
||||
void AssFile::Load (const wxString &_filename,wxString charset,bool addToRecent) {
|
||||
bool ok = true;
|
||||
bool ok = false;
|
||||
|
||||
try {
|
||||
// Try to open file
|
||||
|
@ -102,6 +102,7 @@ void AssFile::Load (const wxString &_filename,wxString charset,bool addToRecent)
|
|||
if (reader) {
|
||||
reader->SetTarget(this);
|
||||
reader->ReadFile(_filename,charset);
|
||||
ok = true;
|
||||
}
|
||||
|
||||
// Couldn't find a type
|
||||
|
@ -111,18 +112,20 @@ void AssFile::Load (const wxString &_filename,wxString charset,bool addToRecent)
|
|||
// String error
|
||||
catch (const wchar_t *except) {
|
||||
wxMessageBox(except,_T("Error loading file"),wxICON_ERROR | wxOK);
|
||||
ok = false;
|
||||
}
|
||||
|
||||
catch (wxString except) {
|
||||
wxMessageBox(except,_T("Error loading file"),wxICON_ERROR | wxOK);
|
||||
ok = false;
|
||||
}
|
||||
|
||||
// Real exception
|
||||
catch (agi::Exception &e) {
|
||||
wxMessageBox(wxString(e.GetChainedMessage().c_str(), wxConvUTF8), L"Error loading file", wxICON_ERROR|wxOK);
|
||||
}
|
||||
|
||||
// Other error
|
||||
catch (...) {
|
||||
wxMessageBox(_T("Unknown error"),_T("Error loading file"),wxICON_ERROR | wxOK);
|
||||
ok = false;
|
||||
}
|
||||
|
||||
// Verify loading
|
||||
|
|
Loading…
Reference in a new issue