{"id":15066049,"url":"https://github.com/ap-dev-at-home/results","last_synced_at":"2026-01-02T20:32:11.844Z","repository":{"id":257043227,"uuid":"857143462","full_name":"ap-dev-at-home/Results","owner":"ap-dev-at-home","description":"C# - Fluent/Chainable Error, Result and Exception Handling","archived":false,"fork":false,"pushed_at":"2025-03-01T23:27:50.000Z","size":80,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-16T01:12:19.605Z","etag":null,"topics":["chainable-methods","csharp","dotnet","error-handling","exception-handling","fluent","result","result-handling"],"latest_commit_sha":null,"homepage":"","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/ap-dev-at-home.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":"2024-09-13T22:32:36.000Z","updated_at":"2025-03-01T23:27:54.000Z","dependencies_parsed_at":"2024-10-27T22:51:05.757Z","dependency_job_id":"96bd55ac-a8e8-4ab7-be87-42f7f65c919e","html_url":"https://github.com/ap-dev-at-home/Results","commit_stats":null,"previous_names":["ap-dev-at-home/results"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ap-dev-at-home%2FResults","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ap-dev-at-home%2FResults/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ap-dev-at-home%2FResults/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ap-dev-at-home%2FResults/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ap-dev-at-home","download_url":"https://codeload.github.com/ap-dev-at-home/Results/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243809885,"owners_count":20351407,"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":["chainable-methods","csharp","dotnet","error-handling","exception-handling","fluent","result","result-handling"],"created_at":"2024-09-25T01:00:38.072Z","updated_at":"2026-01-02T20:32:11.808Z","avatar_url":"https://github.com/ap-dev-at-home.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Results - Result and Exception Handling\n\n**Current Status**: In Development/Trial Phase - final behaviour not determined yet\n\n**Goal**: Simplify result and exception handling using chainable method calls.\n\n## Table of Contents\n\n- [Result - API](#result---api)\n- [Modifications - API](#modifications---api)\n- [Execute - API](#execute---api)\n- [ResultsJson - API](#resultsjson---exception-safe-json)\n\n### Result - API\n| Method | Parameter | Return |\n|----------|----------|----------|\n| Result.Ok() \u003cbr\u003e *- static method*| | A successful Result |\n| Result.Ok(T `value`) \u003cbr\u003e *- static method*| `value` - the value contained by the result | A successful Result of value type T |\n| Result.Fail(string `message`) \u003cbr\u003e *- static method*| `message` - the error message | A failed Result |\n| Result.Fail(Error `error`) \u003cbr\u003e *- static method*| `error` - the error | A failed Result |\n| Result.Fail() \u003cbr\u003e *- static method*| | A failed Result |\n| Result.NotNull(T? `value`, string `message`) \u003cbr\u003e *- static method* | `value`- a result value\u003cbr\u003e\u003cbr\u003e`message` - the error message, set if `value` is null | If `value` is not null - A successful Result containing the value \u003cbr\u003e\u003cbr\u003e If `value` is null - A failed Result containing error `message` |\n| Result.Handover(params object?[] `value`) \u003cbr\u003e *- static method* | `value` - array of obejcts to pass over to the next **Then** call. \u003cbr\u003e\u003cbr\u003e Results will be unwrapped to their containing value before passed over to the next **Then** call\u003cbr\u003e\u003cbr\u003e Any other object will simply be passed over | A Handover ResultCollection |\n| Result.`Value` | Property of genric type TValue | The results internal value |\n| Result.`Success` | Property of type Bool | The result status |\n| Result.`Failed` | Property of type Bool | The result inverted status |\n| Result.`Error`| Property of type Error | The error |\n| Result.`Logs`| Property of type List\\\u003cLogEntry\u003e | The logs |\n\n### Modifications - API\n| Method | Parameter | Return |\n|----------|----------|----------|\n|Result\\\u003cTValue\u003e.WhenNull(TValue `value`) | `value` - value to set if the current result value is null\u003cbr\u003e\u003cbr\u003e No effect on a failed result. | The Result (itself) |\n|Result\\\u003cTValue\u003e.Assert(`Func\u003cTValue, bool\u003e`, string `message`)| `Func` - function receiving the value, returning a bool expression \u003cbr\u003e\u003cbr\u003eIf the expression evaluates to false the result will be set to fail - `message` will be set \u003cbr\u003e\u003cbr\u003eNo effect on a failed result. | The Result (itself) |\n|Result\\\u003cTValue\u003e.Recover(TValue `value`) | `value` - value to set to a new Result object if the current result is in a failed status \u003cbr\u003e\u003cbr\u003eOnly affects a failed result. | The Result (itself) - if it was in a success status\u003cbr\u003e\u003cbr\u003eA new success Result containing `value` - if it was failed status |\n\n### Execute - API\n| Method | Parameter | Return |\n|----------|----------|----------|\n| Result.Do(`Func\u003cResult\u003cTResult\u003e\u003e`) \u003cbr\u003e *- static method* | `Func` - function to be called | A `Result` of type `TResult` returned from `Func` |\n| Result.DoAsync(`Func\u003cResult\u003cTResult\u003e\u003e`) \u003cbr\u003e *- static method* | `Func` - function to be called | A `Task\u003cResult\u003e` of type `TResult` |\n| Result.DoInterlocked(`Func\u003cResult\u003cTResult\u003e\u003e`, `object`, `wait`) \u003cbr\u003e *- static method* | `Func` - function to be called\u003cbr\u003e\u003cbr\u003e`object` - object to acquire the lock on\u003cbr\u003e\u003cbr\u003e`wait` - optional (default true) - if false the method will immediately return if the lock can not be aquired| A `Result` of type `TResult` returned from `Func` \u003cbr\u003e\u003cbr\u003e A failed `Result` with `Error` of type `InterlockError`, if the lock can not be acquired. |\n| Result.Try(`Func\u003cResult\u003cTResult\u003e\u003e`, `Action\u003cException\u003e?`) \u003cbr\u003e *- static method* | `Func` - function to be called \u003cbr\u003e Surrounded by a try catch\u003cbr\u003e\u003cbr\u003e`Action` - Optional - called on exception\u003cbr\u003eThe Exception is passed| A `Result` of type `TResult` returned from `Func`\u003cbr\u003e\u003cbr\u003eIf an exception occurs - A failed `Result` containing the exception |\n| Result.Try(`Action`, `Action\u003cException\u003e?`) \u003cbr\u003e *- static method* | `Action` - action to be called \u003cbr\u003e Surrounded by a try catch\u003cbr\u003e\u003cbr\u003e`Action` - Optional - called on exception\u003cbr\u003eThe Exception is passed| A success `Result` \u003cbr\u003e\u003cbr\u003eIf an exception occurs - A failed `Result` containing the exception |\n| Result.TryAsync(`Func\u003cResult\u003cTResult\u003e\u003e`, `Action\u003cException\u003e?`) \u003cbr\u003e *- static method* | `Func` - function to be called \u003cbr\u003e Surrounded by a try catch\u003cbr\u003e\u003cbr\u003e`Action` - Optional - called on exception\u003cbr\u003eThe Exception is passed | A `Task\u003cResult\u003e` of type `TResult` \u003cbr\u003e\u003cbr\u003eIf an exception occurs - A failed `Result` containing the exception |\n| Result.TryInterlocked(`Func\u003cResult\u003cTResult\u003e\u003e`, `object`, `wait`, `Action\u003cException\u003e?`) \u003cbr\u003e *- static method* | `Func` - function to be called\u003cbr\u003e\u003cbr\u003e`object` - object to acquire the lock on\u003cbr\u003e\u003cbr\u003e`wait` - optional (default true) - if false the method will immediately return if the lock can not be aquired \u003cbr\u003e\u003cbr\u003e`Action` - Optional - called on exception\u003cbr\u003eThe Exception is passed | A `Result` of type `TResult` returned from `Func` \u003cbr\u003e\u003cbr\u003e A failed `Result` with `Error` of type `InterlockError`, if the lock can not be acquired. |\n| Result\\\u003cTResult\u003e.Then(`Func\u003cT1..T4, TResult\u003e`)| `Func` - function to be called \u003cbr\u003e Up to 4 handover parameters\u003cbr\u003e\u003cbr\u003eIf a failed Result is passed from the previous call - **Then** will not be called\u003cbr\u003e\u003cbr\u003eIf a Handover object is passed from the previous call containing any failed result - **Then** will not be called | The Result returned from Func |\n| Result.FailFast(params `Func\u003cResult\u003e[]`) \u003cbr\u003e *- static method* | `Func[]` - functions to be called \u003cbr\u003e\u003cbr\u003e Every call must return a Result. \u003cbr\u003e\u003cbr\u003e A failing call will stop further calls.| Success ResultCollection - if no call failed \u003cbr\u003e\u003cbr\u003e Failed ResultCollection - if any call failed |\n| Result.FailSafe(params `Func\u003cResult\u003e[]`) \u003cbr\u003e *- static method* | `Func[]` - functions to be called \u003cbr\u003e\u003cbr\u003e Every call must return a Result. \u003cbr\u003e\u003cbr\u003e A failing call will not stop further calls.| Success ResultCollection - if no call failed \u003cbr\u003e\u003cbr\u003e Failed ResultCollection - if any call failed |\n| More to come - Development in Progress...|||\n\n### ResultsJson - Exception Safe Json\n| Method Signature | Description | \n|------------------|-------------| \n| Json.From\\\u003cT\u003e(string jsonString) | Deserializes a JSON string into a Result object. | \n| Json.Load\\\u003cT\u003e(string path) | Deserializes a JSON file into a Result object. | \n| Json.Save\\\u003cT\u003e(string path, T obj) | Serializes an object to a JSON file. | \n| Json.From\\\u003cT\u003e(Stream stream) | Deserializes a JSON stream into a Result object. | \n| Json.From\\\u003cT\u003e(ReadOnlySpan\u003cbyte\u003e utf8Json) | Deserializes a JSON byte span into a Result object. |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fap-dev-at-home%2Fresults","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fap-dev-at-home%2Fresults","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fap-dev-at-home%2Fresults/lists"}