Often what I'll do is either use a private method inside the facade for standard error handling / logging if there's a lot of overlap or use a static class in C# with extension method support so, the class might look like this for logging:
publicstaticErrorExtensions{publicvoidLogError(thisExceptionex){// Do some actual error logging hereConsole.WriteLine(ex.Message);}}
If, for some reason, you have multiple facades in an application (can happen if you support different types of external callers, for example), you can extract a base class for all facades and add protected methods for these cross-cutting concerns.
The other thing you could consider is following an Action pattern where you have a single method that does standard stuff like validation and error handling and it just takes in a function that it invokes for the implementation-specific logic.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Often what I'll do is either use a private method inside the facade for standard error handling / logging if there's a lot of overlap or use a static class in C# with extension method support so, the class might look like this for logging:
and then in my handler I might do:
If, for some reason, you have multiple facades in an application (can happen if you support different types of external callers, for example), you can extract a base class for all facades and add protected methods for these cross-cutting concerns.
The other thing you could consider is following an
Action
pattern where you have a single method that does standard stuff like validation and error handling and it just takes in a function that it invokes for the implementation-specific logic.