, , , , . API, , , "", . , , , try-catch.
, , , , , .
:
:
private void Error(object sender, EventArgs e) {
Exception ex = sender as Exception;
Console.WriteLine("Error: " + ex);
try {
throw ex;
} catch (put.your.exception.detail.here) {
} finally {
}
}
( , API):
class Foo {
public event EventHandler ThrowError;
protected virtual void OnError(Object src, EventArgs e) {
if (ThrowError != null) {
ThrowError(src, e);
}
}
private virtual void error(Exception e) {
OnError(e, EventArgs.Empty);
}
}