Example #1
0
        /// <summary>The method to call after a dictionary insert throws an exception.</summary>
        /// <param name="key">The dictionary key being inserted.</param>
        /// <param name="__exception">The exception thrown by the wrapped method, if any.</param>
        /// <returns>Returns the exception to throw, if any.</returns>
        private static Exception Finalize_Add(object key, Exception __exception)
        {
            if (__exception is ArgumentException)
            {
                DictionaryPatcher.AddKey(__exception, key);
            }

            return(__exception);
        }
Example #2
0
        /*********
        ** Private methods
        *********/
        /// <summary>The method to call after the dictionary indexer throws an exception.</summary>
        /// <param name="key">The dictionary key being fetched.</param>
        /// <param name="__exception">The exception thrown by the wrapped method, if any.</param>
        /// <returns>Returns the exception to throw, if any.</returns>
        private static Exception Finalize_GetItem(object key, Exception __exception)
        {
            if (__exception is KeyNotFoundException)
            {
                DictionaryPatcher.AddKey(__exception, key);
            }

            return(__exception);
        }