, , (, File.open() - ), try-catch-finally
bool errorOccurred = false;
try {
} catch (Exception e) {
eventLogger.logError("The count is not zero", e);
errorOccurred = true;
} finally {
if (errorOccurred) {
} else {
}
}
, try catch
if (count != 0) {
Exception ex = new Exception();
errorLogger.logError("The count is not zero", ex);
} else {
}
For the second option, you can use different subclasses of inheritance from Exception, or you can even make your own implementation.
source
share