|
static void | Throw (Exception exception, string message, Logger logger) |
| Call this method to throw an exception. More...
|
|
static void | Throw (Exception exception, Logger logger) |
| Call this method to throw an exception. More...
|
|
static void | Caught (Exception exception, Level level, Logger logger) |
| Call this method every time when an exception is caught. More...
|
|
static void | Caught (Exception exception, Level level, string message, Logger logger) |
| Call this method every time when an exception is caught. More...
|
|
static void | CaughtAndThrow (Exception exception, Level level, Logger logger) |
|
static void | CaughtAndThrow (Exception exception, Level level, string message, Logger logger) |
|
static bool | MustRethrow (Exception exception) |
| This method returns true if the exception passed as parameter is a critical exception that should have not been caught. More...
|
|
static string | GetFullMessage (Exception e) |
| Gets an exception message that includes the messages of the inner exceptions. More...
|
|
static void | ThrowInvalidArgument (string argumentName, string message, Logger logger) |
| Call this method to throw ArgumentException for an invalid argument. More...
|
|
static void | ThrowArgumentOutOfRange (string argumentName, string message, Logger logger) |
| Call this method to throw ArgumentOutOfRangeException exception. More...
|
|
static void | ThrowIfArgumentNull (object argument, string name, Logger logger) |
| Call this method to check if an argument is null and throw ArgumentNullException exception. More...
|
|
static void | ThrowIfObjectDisposed (bool disposed, object o, Logger logger) |
| Call this method to throw ObjectDisposedException if an object is disposed. More...
|
|
static bool Org.Apache.REEF.Utilities.Diagnostics.Exceptions.MustRethrow |
( |
Exception |
exception | ) |
|
|
inlinestatic |
This method returns true if the exception passed as parameter is a critical exception that should have not been caught.
Examples for such exceptions are StackOverflowException and OutOfMemoryException.
Catch statements which catch all exceptions must call this method immediately and rethrow without further processing if the method returns true.
try { // Some code that can throw } catch (Exception e) { if (Exceptions.MustRethrow(e)) { throw; } // Exception handling code }
- Parameters
-
exception | The exception to be checked. |
- Returns
- True if the exceptions is critical one and should not be caught and false otherwise.
static void Org.Apache.REEF.Utilities.Diagnostics.Exceptions.ThrowIfObjectDisposed |
( |
bool |
disposed, |
|
|
object |
o, |
|
|
Logger |
logger |
|
) |
| |
|
inlinestatic |
Call this method to throw ObjectDisposedException if an object is disposed.
All disposable objects should check their state and throw in the beginning of each public method. This helper method provides a shorter way to do this.
class SomeClass : IDisposable { bool _disposed; // ... public void SomePublicMethod() { Exceptions.ThrowIfObjectDisposed(_disposed, this); // Method's code } }
- Parameters
-
disposed | True if the object is disposed. |
o | The object. |
logger | The logger of the caller class. |