Skip to content
Browse files

Return a tuple instead of a 3 element tuple. Consistency is good.

  • Loading branch information...
1 parent 06bf60f commit 6a15ed036870e535564281b7e297845f7af863a5 @msantos committed
Showing with 6 additions and 3 deletions.
  1. +3 −1 README
  2. +3 −2 c_src/procket.c
View
4 README
@@ -8,7 +8,7 @@ R13B03.
EXPORTS
-listen(Port, Options) -> {ok, FD} | {error, Reason} | {error, Reason, Description}
+listen(Port, Options) -> {ok, FD} | {error, Reason} | {error, {Reason, Description}}
Types Port = 0..65535
Options = [Opts]
@@ -16,6 +16,8 @@ listen(Port, Options) -> {ok, FD} | {error, Reason} | {error, Reason, Descriptio
{progname, string()}
Protocol = tcp | udp
IPAddress = string() | tuple()
+ Reason = atom()
+ Description = string()
COMPILING
View
5 c_src/procket.c
@@ -198,10 +198,11 @@ error_tuple(ErlNifEnv *env, char *atom, char *err)
static ERL_NIF_TERM
error_message(ErlNifEnv *env, char *atom, char *err, char *msg)
{
- return enif_make_tuple(env, 3,
+ return enif_make_tuple(env, 2,
enif_make_atom(env, atom),
+ enif_make_tuple(env, 2,
enif_make_atom(env, err),
- enif_make_string(env, msg));
+ enif_make_string(env, msg)));
}

0 comments on commit 6a15ed0

Please sign in to comment.
Something went wrong with that request. Please try again.