[99s-extend] Mandatory init/3 and optional handle/2 and terminate/3

Loïc Hoguin essen at ninenines.eu
Wed Jun 4 23:46:38 CEST 2014


You shouldn't say -behavior(cowboy_http_handler) if you don't actually 
implement it.

On 06/04/2014 11:37 PM, Paulo F. Oliveira wrote:
> Hello.
>
> You wrote here
> <http://ninenines.eu/docs/en/cowboy/HEAD/manual/cowboy_rest/> that "The
> only mandatory callback is init/3, needed to perform the protocol upgrade."
>
> In my code I have only this function for the protocol upgrade:
>
> init({_TransportName, _ProtocolName}, _Req, []) ->
>      {upgrade, protocol, cowboy_rest}.
>
> On the other hand, when compiling, I get the following warnings:
>
> src/handler_transactions.erl:3: Warning: undefined callback function
> handle/2 (behaviour 'cowboy_http_handler')
> src/handler_transactions.erl:3: Warning: undefined callback function
> terminate/3 (behaviour 'cowboy_http_handler')
>
> Is this the expected behavior? I know I _can_ ignore the warnings, but
> not if I want to use Erlang compiler option warnings_as_errors, for example.
>
> Many thanks.
>
> - Paulo F. Oliveira
>
>
> _______________________________________________
> Extend mailing list
> Extend at lists.ninenines.eu
> https://lists.ninenines.eu/listinfo/extend
>

-- 
Loïc Hoguin
http://ninenines.eu


More information about the Extend mailing list