Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use custom exception types #72

Open
KennethHoff opened this issue Feb 22, 2024 · 0 comments
Open

Use custom exception types #72

KennethHoff opened this issue Feb 22, 2024 · 0 comments

Comments

@KennethHoff
Copy link

I noticed that in various places (GitHub search) you are throwing the base Exception type, which is not recommended.

Would it be possible to create a custom base Exception like SanityException and whenever you throw, throw an Exception that derives from it?

Here for example, you could throw a SanitySerializationException such that we - as a consumer of this library - can utilize the catch (SanityException ex) or catch (SanitySerializationException ex) syntaxes.

catch (Exception ex)
{
throw new Exception($"Failed to deserialize Sanity response: {content}", ex);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant