Skip to content

More detailed error messages - #381

Merged
jcjones merged 5 commits into
letsencrypt:masterfrom
bmw:errors
Jun 19, 2015
Merged

jcjones merged 5 commits into
letsencrypt:masterfrom
bmw:errors

Conversation

@bmw

@bmw bmw commented Jun 19, 2015

Copy link
Copy Markdown
Contributor

This PR adds the ability for the server to send more detailed error messages back to the client. I did not add any new error codes or types. Instead, I just modified sendError and cleaned up error messages in a few places.

As it did previously, sendError takes a string, interface, and a HTTP status code. The change is the interface is included in the error message if all of the following conditions apply:

  1. The status code isn't 500.
  2. The interface is one of our defined error types, as determined by statusCodeFromError.
  3. The interface isn't a core.ServerInternalError.

If these conditions apply, sendError sends both the string passed to sendError and the error message passed in the interface parameter to the client. This allows for more detailed error messages in cases like #344, which now returns:

{
    "type": "urn:acme:error:malformed",
    "detail": "Error creating new registration :: No MX record for domain foo.foo"
}

Coming with this, we need to be careful when wrapping internal error messages in error types that isn't core.ServerInternalError. I went through all of the current code and removed any instances where we do this (the three changes in registration-authority.go). I'm not certain there was a problem, but I think it's better to err on the safe side to prevent leaking any internal information.

@jcjones

jcjones commented Jun 19, 2015

Copy link
Copy Markdown
Contributor

I agree that we need to be careful; in particular, InternalServerError is expected to be caught by the proxy and replaced with a different page - per normal proxy behavior.

This change looks good to me. Merging.

jcjones added a commit that referenced this pull request Jun 19, 2015
More detailed error messages
@jcjones
jcjones merged commit adaba3a into letsencrypt:master Jun 19, 2015
@kuba

kuba commented Jun 20, 2015

Copy link
Copy Markdown
Contributor

Thank you!

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

Successfully merging this pull request may close these issues.

3 participants