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

Paulo F. Oliveira paulo.ferraz.oliveira at gmail.com
Thu Jun 5 01:49:01 CEST 2014


Got it, thanks.

This here <http://ninenines.eu/docs/en/cowboy/HEAD/manual/cowboy_rest/> had
the fine print that I hadn't read apparently: "This module cannot be
described as a behaviour due to most of the callbacks it defines being
optional. It has the same semantics as a behaviour otherwise."

- Paulo F. Oliveira


On 4 June 2014 22:46, Loïc Hoguin <essen at ninenines.eu> wrote:

> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ninenines.eu/archives/extend/attachments/20140605/46eee3c0/attachment.html>


More information about the Extend mailing list