Selaa lähdekoodia

Catch exception object by reference rather than value.

adeniz_1
Alban Deniz 1 vuosi sitten
vanhempi
commit
778418941a
1 muutettua tiedostoa jossa 16 lisäystä ja 16 poistoa
  1. 16
    16
      SNFMulti.cpp

+ 16
- 16
SNFMulti.cpp Näytä tiedosto

@@ -186,27 +186,27 @@ void snf_Reloader::myTask() {
MyRulebase.logThisInfo( // Log our success.
snfReloadContext, snf_SUCCESS, "Success");
}
catch(snf_RulebaseHandler::IgnoreListError) { // If we get an IgnoreListError - say so.
catch(snf_RulebaseHandler::IgnoreListError&) { // If we get an IgnoreListError - say so.
MyRulebase.logThisError(
snfReloadContext, snf_ERROR_RULE_FILE, "IgnoreListError");
}
catch(snf_RulebaseHandler::ConfigurationError) { // If we get a ConfigurationError - say so.
catch(snf_RulebaseHandler::ConfigurationError&) { // If we get a ConfigurationError - say so.
MyRulebase.logThisError(
snfReloadContext, snf_ERROR_RULE_FILE, "ConfigurationError");
}
catch(snf_RulebaseHandler::FileError x) { // If we get a FileError - say so.
catch(snf_RulebaseHandler::FileError &x) { // If we get a FileError - say so.
MyRulebase.logThisError(
snfReloadContext, snf_ERROR_RULE_FILE, "FileError");
}
catch(snf_RulebaseHandler::AuthenticationError x) { // If we get a Auth Error - say so.
catch(snf_RulebaseHandler::AuthenticationError &x) { // If we get a Auth Error - say so.
MyRulebase.logThisError(
snfReloadContext, snf_ERROR_RULE_AUTH, "AuthError");
}
catch(snf_RulebaseHandler::Busy x) { // If we get a Busy Exception - say so.
catch(snf_RulebaseHandler::Busy &x) { // If we get a Busy Exception - say so.
MyRulebase.logThisError(
snfReloadContext, snf_ERROR_UNKNOWN, "BusyError");
}
catch(snf_RulebaseHandler::Panic x) { // If we get a Panic - say so.
catch(snf_RulebaseHandler::Panic &x) { // If we get a Panic - say so.
MyRulebase.logThisError(
snfReloadContext, snf_ERROR_UNKNOWN, "PanicError");
}
@@ -396,19 +396,19 @@ void snf_RulebaseHandler::_snf_LoadNewRulebase(){
}
} // If nothing threw, we're golden!

catch (TokenMatrix::BadFile) { // BadFile translates to FileError
catch (TokenMatrix::BadFile&) { // BadFile translates to FileError
throw FileError("_snf_LoadNewRulebase() TokenMatrix::BadFile");
}
catch (TokenMatrix::BadMatrix) { // BadMatrix translates to AuthenticationError
catch (TokenMatrix::BadMatrix&) { // BadMatrix translates to AuthenticationError
throw AuthenticationError("_snf_LoadNewRulebase() TokenMatrix::BadMatrix");
}
catch (TokenMatrix::BadAllocation) { // BadAllocation translates to AllocationError
catch (TokenMatrix::BadAllocation&) { // BadAllocation translates to AllocationError
throw AllocationError("_snf_LoadNewRulebase() TokenMatrix::BadAllocation");
}
catch (TokenMatrix::OutOfRange) { // OutOfRange should never happen so PANIC!
catch (TokenMatrix::OutOfRange&) { // OutOfRange should never happen so PANIC!
throw Panic("_snf_LoadNewRulebase() TokenMatrix::OutOfRange");
}
catch (exception e) {
catch (exception &e) {
throw;
}
catch (...) { // Something unpredicted happens? PANIC!
@@ -880,7 +880,7 @@ string& snf_IPTestEngine::test(string& input, string& output) {
output.append(S.str());
output.append("}");
}
catch(snfScanData::NoFreeIPScanRecords) {
catch(snfScanData::NoFreeIPScanRecords&) {
output = "{too_many}";
}
catch(...) {
@@ -1591,7 +1591,7 @@ int snf_EngineHandler::scanMessage(
for(int a = 0; a < snf_ScanHorizon; a++) // the message through the filter
MyScanData.FilteredData.push_back(xb=IZ.GetByte()); // chain into the FilteredData buffer.
} // When we run out of data we will
catch(FilterChain::Empty) {} // get the Empty exception and stop.
catch(FilterChain::Empty&) {} // get the Empty exception and stop.

// Scan each byte in the file up to the horizon or the end of the message.
// If something goes wrong, an exception will be thrown.
@@ -1614,13 +1614,13 @@ int snf_EngineHandler::scanMessage(

DebugInfo = "scanMessage() Scan Data Complete"; // If we panic, here we are.
}
catch(EvaluationMatrix::BadAllocation) { // Check for bad allocation during scan.
catch(EvaluationMatrix::BadAllocation&) { // Check for bad allocation during scan.
throw AllocationError("EvaluationMatrix::BadAllocation");
}
catch(EvaluationMatrix::MaxEvalsExceeded) { // Check for too many evaluators.
catch(EvaluationMatrix::MaxEvalsExceeded&) { // Check for too many evaluators.
throw MaxEvals("EvaluationMatrix::MaxEvalsExceeded");
}
catch(EvaluationMatrix::OutOfRange) { // Check for out of range of (bad) matrix.
catch(EvaluationMatrix::OutOfRange&) { // Check for out of range of (bad) matrix.
throw BadMatrix("EvaluationMatrix::OutOfRange");
}
catch(exception& e) { // Some other known exception?

Loading…
Peruuta
Tallenna