Tell me, please, throwing exceptions to the top is a normal practice?
Just now, in my project, I tried to do this (or rather made it into all the bottlenecks, especially where the work with the database is going), and it seemed to me convenient in terms of finding errors and debugging.
An example ( ignore the logic, only probros exceptions are interested ):
// Получение какого-либо значения из базы данных в виде object private object GetData_AsObject() { try { //тут идет получение данных из бд } catch (Exception e) { throw new Exception("Получение данных из " + tableName + "." + column); } } // Получение какого-либо значения из базы данных в виде string public string GetData_AsString() { try { if (GetData_AsObject() != null) return GetData_AsObject().ToString(); else return ""; } catch (Exception e) { throw new Exception(e.Message + " as string"); } } // Получение какого-либо значения из базы данных в виде int public int GetData_AsInt() { try { if (GetData_AsObject() != null) return int.Parse(GetData_AsObject().ToString()); else return 0; } catch (Exception e) { throw new Exception(e.Message + " as int"); } } And so the exception rises above. If somewhere in the code there is an exception handling, then it is executed and does not bother the user. If there is no processing, the user receives a complete error message.
But the code produces a lot of try-catch constructs. Is this considered to be littering?