Skip to content
Discussion options

You must be logged in to vote

After discussing with @HaloFour , @theunrepentantgeek and @CyrusNajmabadi on how to actually solve the issue that I want to solve, this approach wasn't what I want, but actually I think is better.

I use a result class which you can find here with all the needed code https://gist.github.com/proteo5/cf629c7f4575b4ec486cb36425be270a

so first I define a custom exception:

public class CheckRuleException : Exception
{
    public readonly Result _result;

    public CheckRuleException(string message, Result result) : base(message)
    {
        _result = result;
    }

    public Result Result { get { return _result; } }
}

Then the rule will throw that exception whereever a rule doesn't pass

pu…

Replies: 4 comments 30 replies

Comment options

You must be logged in to vote
7 replies
@HaloFour
Comment options

@proteo5
Comment options

@HaloFour
Comment options

@proteo5
Comment options

@proteo5
Comment options

Comment options

You must be logged in to vote
15 replies
@proteo5
Comment options

@HaloFour
Comment options

@CyrusNajmabadi
Comment options

@proteo5
Comment options

@CyrusNajmabadi
Comment options

Comment options

You must be logged in to vote
8 replies
@HaloFour
Comment options

@proteo5
Comment options

@HaloFour
Comment options

@theunrepentantgeek
Comment options

@proteo5
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by proteo5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants