]> granicus.if.org Git - ejabberd/commitdiff
Show and throw error when captcha_cmd is required but not configured.
authorBadlop <badlop@process-one.net>
Mon, 11 Jan 2010 22:21:23 +0000 (22:21 +0000)
committerBadlop <badlop@process-one.net>
Mon, 11 Jan 2010 22:21:23 +0000 (22:21 +0000)
SVN Revision: 2874

src/ejabberd_captcha.erl

index 3177988628af96aa23fb0e3d90d76f3fbef62eda..4d3d2e009d5398a4b046703549b577f1018b3a91 100644 (file)
@@ -328,7 +328,9 @@ get_prog_name() ->
        FileName when is_list(FileName) ->
            FileName;
        _ ->
-           ""
+           ?CRITICAL_MSG("The option captcha_cmd is not configured, but some "
+                         "module wants to use the CAPTCHA feature.", []),
+           throw({error, option_not_configured_captcha_cmd})
     end.
 
 get_url(Str) ->
@@ -388,9 +390,10 @@ return(Port, TRef, Result) ->
     Result.
 
 is_feature_enabled() ->
-    case get_prog_name() of
-       "" -> false;
+    try get_prog_name() of
        Prog when is_list(Prog) -> true
+    catch 
+       _:_ -> false
     end.
 
 is_feature_available() ->