Age | Commit message (Collapse) | Author |
|
|
|
We handle these errors nicely in the dispatcher and have tests for that.
Tests should fail or err out when running into exceptions we are not
handling yet. But for these it's better to just skip.
|
|
|
|
If one source raises a 502 and no other handler has any result we'll
respond with a 502 - bad gateway.
|
|
|
|
Handler Chain is of handlers that respond to call.
Invoking handle(*args) on the chain will call the handlers with the given args
until one of them returns a result that is truethy (i.e. not false or nil).
Extracted from the dispatcher so we can also handle exceptions there in the
future. (So that if one of the network connections to the request_handlers
fails we can continue while still tracking the failed exception.)
|
|
Also changed Nickserver::Response to not include the status code.
This may be okay for error responses but in most cases we want to
have a parsable message and not some status code prepended to it.
|
|
Whenever a RequestHandler class is called we instantiate it with the request.
Then we call handle on the instance. This way we can access the request and
its content via accessors rather than only in the handle method.
|
|
|
|
InvalidEmailHandler - handle emails with an invalid format
LocalEmailHandler - handle emails on the local domain
EmailHandler - handle all other emails by using hkp
This is a preparation to add leap provider email lookup and remove
hkp eventually. But for now we keep the behaviour the same and only
refactor.
|
|
Instead of testing the preconditions for each handler in the dispatcher
the dispatcher hands a request to one handler after the other until one of
them responds.
This is similar to the Chain of Responsibility patter but we iterate over the
'handler_chain' array instead of a linked list.
To change the order of handlers or add other handlers change the array in the
handler_chain function.
|
|
Now we have a Dispatcher and two ResponseHandlers that have the same interface.
Moving towards a Chain of Responsibility pattern.
|