mirror of
https://github.com/Azure/DotNetty.git
synced 2026-10-20 07:37:46 +08:00
8114b7fb21
Motivation: Modern language features provide for easier to read, more compact code. Modifications: - expression body for single line methods - Extra: fixes in xml docs - Extra: code style deviations in recent commits Result: Cleaner, more consistent code.
22 lines
778 B
C#
22 lines
778 B
C#
// Copyright (c) Microsoft. All rights reserved.
|
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
|
|
namespace DotNetty.Tests.End2End
|
|
{
|
|
using System;
|
|
using System.Diagnostics.Contracts;
|
|
using DotNetty.Transport.Channels;
|
|
|
|
class ExceptionCatchHandler : ChannelHandlerAdapter
|
|
{
|
|
readonly Action<Exception> exceptionCaughtAction;
|
|
|
|
public ExceptionCatchHandler(Action<Exception> exceptionCaughtAction)
|
|
{
|
|
Contract.Requires(exceptionCaughtAction != null);
|
|
this.exceptionCaughtAction = exceptionCaughtAction;
|
|
}
|
|
|
|
public override void ExceptionCaught(IChannelHandlerContext context, Exception exception) => this.exceptionCaughtAction(exception);
|
|
}
|
|
} |