Found 409 packages
A simple, fluent, extensible, and fully customizable library for throwing exceptions using .NET 6+
Captures LogContext of a thrown exception to enrich logs when the exception is eventually logged.
Method input validation and runtime checks that report errors or throw exceptions when failures are detected.
This package includes .NET helpers such as: - Guard: Helper methods to verify conditions when running code. - ThrowHelper: Helper methods to efficiently throw exceptions.
A Simple Library that throws exceptions for common use-cases in a single line.
A library to check your arguments in a simple comfort way. This library do not use Expression or nameof. It is based on Func<T>. So no performance issue during positive argument check.
An extensible argument validation package by @JarrydVanHoy that I feel reads quite fluently.
Throw helpers and guard methods
Pitcher is helper library to simplify throwing exceptions and make methods easier to inline by reducing code size.
Package Description
Throw your exceptions easily.
Simple Guard Clause Helper
# ThrowAway **ThrowAway** is a pragmatic and efficient C# library that marries functional programming concepts with traditional procedural error handling. It is designed to elegantly manage the dichotomy between successful outcomes (`Values`) and error states (`Failures`) by leveraging the power of the **Option** type. This hybrid approach makes it easy to write expressive, functional code while still integrating seamlessly with conventional try-catch exception handling. ## Overview In many C# applications, error handling is either bogged down by traditional exception logic or forced into a rigid functional style. ThrowAway bridges these two worlds by offering: - **Explicit Functional Handling:** Model success and failure as first-class citizens with Option types. - **Seamless Procedural Integration:** Implicit conversions let you work with Options as if they were plain values - while automatically throwing a `HasFailedException` when an Option is in a failed state. This allows you to mix functional transformations with traditional try-catch error management. ## Key Features - **Dual Outcomes:** Every operation returns an Option that encapsulates either a valid result (`Value`) or an error (`Failure`). - **Implicit Conversions:** Options automatically convert to their underlying type. When an Option represents a failure, an exception is thrown, enabling smooth integration with procedural exception handling. - **Rich Functional API:** A suite of extension methods (like `Map`, `FlatMap`, `Match`, `Filter`, `Transpose`, and `Use`) enables chaining and composing operations in a functional style. - **No Nulls:** Being struct-based, Options guarantee non-null instances, improving type safety. - **Hybrid Error Handling:** Combines the explicitness of functional error handling with the convenience of procedural exception handling. - **Robust Exception Wrapping:** Methods like `CatchFailure` and `CatchAll` convert exceptions into failed Options, maintaining consistency in error handling. - **Seamless Unwrapping:** `TryUnwrap` lets you extract both the value and the failure message without additional boilerplate.
A small helper library for .NET to throw if an argument does not meet specified criteria. Similar to contract programming or "Guard" classes but a bit more informative as to what it will do.
Simple method to implement the options pattern with 1 line of code.
LinksPlatform's Platform.Exceptions Class Library
DotThrow is a .NET library for automatic exception catching and rule validation
Analyzer that deny "throw" keyword in C#
Extensions to the ArgumentException.ThrowIf methods to cover more scenarios and additional exception types. .Net provides a basic set of ThrowIf extension methods, and this library adds to that list.
Pitcher.Sources is helper library to simplify throwing exceptions and make methods easier to inline by reducing code size. It's a source package for Pitcher, directly adding the code to your library or application without introducing another dependency.