{"id":21528492,"url":"https://github.com/hellokitty/easyception","last_synced_at":"2025-04-28T14:10:51.108Z","repository":{"id":84548138,"uuid":"62420069","full_name":"HelloKitty/Easyception","owner":"HelloKitty","description":"Provides a fluent API for conditional throwing of exceptions.","archived":false,"fork":false,"pushed_at":"2016-07-03T09:13:37.000Z","size":43,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-30T10:23:31.355Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HelloKitty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-07-01T21:14:34.000Z","updated_at":"2016-11-06T16:56:54.000Z","dependencies_parsed_at":"2023-03-12T23:29:37.061Z","dependency_job_id":null,"html_url":"https://github.com/HelloKitty/Easyception","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HelloKitty%2FEasyception","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HelloKitty%2FEasyception/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HelloKitty%2FEasyception/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HelloKitty%2FEasyception/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HelloKitty","download_url":"https://codeload.github.com/HelloKitty/Easyception/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251326849,"owners_count":21571636,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-24T01:53:28.389Z","updated_at":"2025-04-28T14:10:51.085Z","avatar_url":"https://github.com/HelloKitty.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Easyception\n\nA library that provides a fluent API for managing exceptions with C# 6. (Must have C# 6 to use the API)\n\n## Setup\n\nTo use this project you'll first need a couple of things:\n  - Visual Studio 2015\n  - C# 6\n\n## How To Use\n\nUsing Easyception is easy. The below sections will dicuss how to utilize the Easyception API to manage exceptions in different ways.\n\n##### How to throw\n\nThrowing exceptions using Easyception is done using semantics that feel like an English sentence. The below example will show how to do this using the most basic version of the **Throw\u003cT\u003e** API to throw an InvalidOperationException.\n\nIf you are unfamilar with the ?. operator refer to this MSDN article on null-conditionals: https://msdn.microsoft.com/en-us/library/dn986595.aspx\n\nIt is absolutely **critical** that you use **?.** for performance reasons. Non-extension version of Now() will throw exceptions when you don't want them if you don't use **?.**\n\n```\nusing Easyception;\n\npublic class Demo\n{\n  public void TestMethod(int val)\n  {\n    Throw\u003cInvalidOperationException\u003e.If.IsTrue(val \u003c 0)?.Now();\n  }\n}\n```\n\nThe above example will throw an **InvalidOperationException** if the provided int **val** is negative. There are various other ways to throw using Throw\u003cT\u003e.If. Explore intellisense to get a feeling for the various methods.\n\nBut wait! We have **special methods** depending on Throw\u003cT\u003e's type T. Check out the example below that highlights special methods that are only available for certain types of T.\n\n```\nusing Easyception;\n\npublic class Demo\n{\n  public void TestMethod(List\u003cint\u003e obj)\n  {\n    Throw\u003cArgumentNullException\u003e.If.IsNull(obj)?.Now();\n  }\n}\n```\n\nThe above example will throw an **ArgumentNullException** if the provided int **List\u003cint\u003e** is null. This **IsNull* method API is only available if T is ArgumentNullException in Throw\u003cT\u003e. Other exception types have methods like this also so check intellisense for them.\n\n## Builds\n\nAvailable on a Nuget Feed: https://www.myget.org/F/hellokitty/api/v2 [![hellokitty MyGet Build Status](https://www.myget.org/BuildSource/Badge/hellokitty?identifier=48dd3f2a-4278-4376-b211-65ca50a5db76)](https://www.myget.org/)\n\nOffical Nuget: https://www.nuget.org/packages/Easyception/\n\n##Tests\n\n#### Linux/Mono - Unit Tests\n||Debug x86|Debug x64|Release x86|Release x64|\n|:--:|:--:|:--:|:--:|:--:|:--:|\n|**master**| N/A | N/A | N/A | [![Build Status](https://travis-ci.org/HelloKitty/Easyception.svg?branch=master)](https://travis-ci.org/HelloKitty/Easyception) |\n|**dev**| N/A | N/A | N/A | [![Build Status](https://travis-ci.org/HelloKitty/Easyception.svg?branch=dev)](https://travis-ci.org/HelloKitty/Easyception)|\n\n#### Windows - Unit Tests\n\n(Done locally)\n\n##Licensing\n\nThis project is licensed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellokitty%2Feasyception","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhellokitty%2Feasyception","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhellokitty%2Feasyception/lists"}