From 999dc5b7c1665fb620c14f6303610793313efe58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Fri, 7 Nov 2014 20:19:05 +0200 Subject: Rename 'halt' to 'stop' for better consistency Now everywhere in Cowboy when we want to stop something we return a 'stop' tuple instead of one of the many choices depending on context that we had before. This particular change affects middlewares, sub protocols and REST handlers which were using 'halt' to stop processing. --- doc/src/guide/middlewares.ezdoc | 2 +- doc/src/guide/rest_handlers.ezdoc | 2 +- doc/src/manual/cowboy_middleware.ezdoc | 4 ++-- doc/src/manual/cowboy_rest.ezdoc | 4 ++-- doc/src/manual/cowboy_sub_protocol.ezdoc | 3 +-- 5 files changed, 7 insertions(+), 8 deletions(-) (limited to 'doc/src') diff --git a/doc/src/guide/middlewares.ezdoc b/doc/src/guide/middlewares.ezdoc index 0c142f9..35e9ea9 100644 --- a/doc/src/guide/middlewares.ezdoc +++ b/doc/src/guide/middlewares.ezdoc @@ -23,7 +23,7 @@ Middlewares can return one of four different values: * `{ok, Req, Env}` to continue the request processing * `{suspend, Module, Function, Args}` to hibernate -* `{halt, Req}` to stop processing and move on to the next request +* `{stop, Req}` to stop processing and move on to the next request Of note is that when hibernating, processing will resume on the given MFA, discarding all previous stacktrace. Make sure you keep the `Req` diff --git a/doc/src/guide/rest_handlers.ezdoc b/doc/src/guide/rest_handlers.ezdoc index 1868f0a..e09790a 100644 --- a/doc/src/guide/rest_handlers.ezdoc +++ b/doc/src/guide/rest_handlers.ezdoc @@ -41,7 +41,7 @@ you need. All callbacks take two arguments, the Req object and the State, and return a three-element tuple of the form `{Value, Req, State}`. -All callbacks can also return `{halt, Req, State}` to stop execution +All callbacks can also return `{stop, Req, State}` to stop execution of the request. The following table summarizes the callbacks and their default values. diff --git a/doc/src/manual/cowboy_middleware.ezdoc b/doc/src/manual/cowboy_middleware.ezdoc index 2275d35..dacaf6c 100644 --- a/doc/src/manual/cowboy_middleware.ezdoc +++ b/doc/src/manual/cowboy_middleware.ezdoc @@ -21,7 +21,7 @@ optionally with its contents modified. : execute(Req, Env) -> {ok, Req, Env} | {suspend, Module, Function, Args} - | {halt, Req} + | {stop, Req} Types: @@ -41,7 +41,7 @@ The `suspend` return value will hibernate the process until an Erlang message is received. Note that when resuming, any previous stacktrace information will be gone. -The `halt` return value stops Cowboy from doing any further +The `stop` return value stops Cowboy from doing any further processing of the request, even if there are middlewares that haven't been executed yet. The connection may be left open to receive more requests from the client. diff --git a/doc/src/manual/cowboy_rest.ezdoc b/doc/src/manual/cowboy_rest.ezdoc index f9e938a..eef622a 100644 --- a/doc/src/manual/cowboy_rest.ezdoc +++ b/doc/src/manual/cowboy_rest.ezdoc @@ -58,7 +58,7 @@ stacktrace of the process when the crash occurred. :: Callbacks -: Callback(Req, State) -> {Value, Req, State} | {halt, Req, State} +: Callback(Req, State) -> {Value, Req, State} | {stop, Req, State} Types: @@ -72,7 +72,7 @@ on the `Value` type, the default value if the callback is not defined, and more general information on when the callback is called and what its intended use is. -The `halt` tuple can be returned to stop REST processing. +The `stop` tuple can be returned to stop REST processing. It is up to the resource code to send a reply before that, otherwise a `204 No Content` will be sent. diff --git a/doc/src/manual/cowboy_sub_protocol.ezdoc b/doc/src/manual/cowboy_sub_protocol.ezdoc index 4ad25f3..ee57beb 100644 --- a/doc/src/manual/cowboy_sub_protocol.ezdoc +++ b/doc/src/manual/cowboy_sub_protocol.ezdoc @@ -8,8 +8,7 @@ by modules that implement a protocol on top of HTTP. : upgrade(Req, Env, Handler, Opts) -> {ok, Req, Env} | {suspend, Module, Function, Args} - | {halt, Req} - | {error, StatusCode, Req} + | {stop, Req} Types: -- cgit v1.2.3