Skip to content

Commit

Permalink
You shall not throw pointers - throw by value, catch by reference
Browse files Browse the repository at this point in the history
  • Loading branch information
adiesner committed Jul 15, 2013
1 parent 6c773a5 commit bf831c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/Fit2TcxConverter.cpp
Expand Up @@ -293,7 +293,8 @@ void Fit2TcxConverter::handle_File_ID(FitMsg_File_ID *fileid) {
case FIT_FILE_MONITORING_DAILY: type="MONITORING_DAILY"; break;
case FIT_FILE_INVALID: type="INVALID"; break;
}
throw new FitFileException("Wrong FIT file type. Expected ACTIVITY, but found: "+type);
FitFileException exc("Wrong FIT file type. Expected ACTIVITY, but found: "+type);
throw exc;
}

string manufacturer="Unknown";
Expand Down
5 changes: 2 additions & 3 deletions src/garminFilebasedDevice.cpp
Expand Up @@ -614,9 +614,8 @@ Thread-Status
} else {
Log::err("Not a fit file: " + workDir + "/" + files[i]);
}
} catch (FitFileException *e) {
Log::err("Exception: " + e->getError());
delete(e);
} catch (FitFileException &e) {
Log::err("Exception: " + e.getError());
} catch (...) {
Log::err("Unknown exception happened while reading fit file!");
}
Expand Down

0 comments on commit bf831c8

Please sign in to comment.