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

Encapsulating ACME errors in exceptions #65

Closed
JeffreyVerbeek opened this issue Mar 6, 2018 · 2 comments
Closed

Encapsulating ACME errors in exceptions #65

JeffreyVerbeek opened this issue Mar 6, 2018 · 2 comments

Comments

@JeffreyVerbeek
Copy link
Contributor

While using the Certes API for a while (1.1.3 / 1.1.4) I noticed that error responses from the ACME endpoint are returned as a System.Exception with the message only being the Certes.Acme.AcmeHttpResponse<T>.Error.Detail variable. Specifically speaking of: EntityContext.cs Line 50 and IAcmeHttpClient.cs Line 61
In order to enable better error handling wouldn't it be nice to encapsulate the error object? Or even better the hole response, as the object that caused the exception. This way there is access to the http status code and the ACME error type. When creating a custom exception type, like AcmeErrorException or something, you could still set the exception message to the Error.Detail variable. So this change should not break any existing code. Any thoughts?

@fszlin
Copy link
Owner

fszlin commented Mar 6, 2018

Hi @JeffreyVerbeek, thanks for pointing it out. This's one of the tech debt items have been lingering since the beginning… 😰

Need to update AcmeError according to the sepc, and define the exception type(s).

@JeffreyVerbeek
Copy link
Contributor Author

True, looking at the spec i noticed the subproblems field is missing as well. Since servers may define there own error types as well, I think a more generic exception type would fit best, but that is up to you 😃
Thanks for the consideration though. The library looks well designed and tested, keep up the good work 👍

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

2 participants