0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-15 20:50:24 +00:00

Fail fast when a wrong type is given to API functions

Idea given by bfrog, fixes issue #34.
This commit is contained in:
Loïc Hoguin 2011-07-18 14:21:45 +02:00
parent 87366e36ad
commit d363f91410
2 changed files with 12 additions and 8 deletions

View file

@ -38,7 +38,9 @@
%% <em>Ref</em> can be used to stop the listener later on.
-spec start_listener(any(), non_neg_integer(), module(), any(), module(), any())
-> {ok, pid()}.
start_listener(Ref, NbAcceptors, Transport, TransOpts, Protocol, ProtoOpts) ->
start_listener(Ref, NbAcceptors, Transport, TransOpts, Protocol, ProtoOpts)
when is_integer(NbAcceptors) andalso is_atom(Transport)
andalso is_atom(Protocol) ->
supervisor:start_child(cowboy_sup,
{{cowboy_listener_sup, Ref}, {cowboy_listener_sup, start_link, [
NbAcceptors, Transport, TransOpts, Protocol, ProtoOpts