From 9319587de60b67f3de689de60b473136fd45cadd Mon Sep 17 00:00:00 2001 From: Magnus Henoch Date: Thu, 15 Sep 2011 09:51:33 +0100 Subject: Specify file name and error on create_cookie failure The error message for failing to create a cookie file is much more helpful when it specifies the actual file it tried to use and the error that occurred. --- lib/kernel/src/auth.erl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib/kernel/src/auth.erl') diff --git a/lib/kernel/src/auth.erl b/lib/kernel/src/auth.erl index ac25ab958c..7bdaa63d07 100644 --- a/lib/kernel/src/auth.erl +++ b/lib/kernel/src/auth.erl @@ -381,13 +381,17 @@ create_cookie(Name) -> case {R1, R2} of {ok, ok} -> ok; - {{error,_Reason}, _} -> - {error, "Failed to create cookie file"}; + {{error,Reason}, _} -> + {error, + lists:flatten( + io_lib:format("Failed to write to cookie file '~s': ~p", [Name, Reason]))}; {ok, {error, Reason}} -> {error, "Failed to change mode: " ++ atom_to_list(Reason)} end; - {error,_Reason} -> - {error, "Failed to create cookie file"} + {error,Reason} -> + {error, + lists:flatten( + io_lib:format("Failed to create cookie file '~s': ~p", [Name, Reason]))} end. random_cookie(0, _, Result) -> -- cgit v1.2.3