Tweak error wrapping

Use the usual `result` properties on errors if they are present. E.g. an error
with a headers property will set the headers for the response, an error with a
`body` property will set the body.