From 6f260c38ce2a75d86dbd4348e973ffca629d331b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn-Egil=20Dahlberg?= Date: Thu, 10 Feb 2011 14:23:20 +0100 Subject: Fix exception generation in the io module Some functions did not generate correct badarg exception on a badarg exception. Affected functions: - io:put_chars/1,2 - io:nl/1 - io:write/1,2 - io:format/1,2,3 - io:fwrite/1,2,3 --- lib/stdlib/src/io.erl | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'lib/stdlib') diff --git a/lib/stdlib/src/io.erl b/lib/stdlib/src/io.erl index 78412ab2bc..3efa68ca09 100644 --- a/lib/stdlib/src/io.erl +++ b/lib/stdlib/src/io.erl @@ -55,26 +55,12 @@ to_tuple(T) when is_tuple(T) -> T; to_tuple(T) -> {T}. -%% Problem: the variables Other, Name and Args may collide with surrounding -%% ones. -%% Give extra args to macro, being the variables to use. --define(O_REQUEST(Io, Request), - case request(Io, Request) of - {error, Reason} -> - [Name | Args] = tuple_to_list(to_tuple(Request)), - erlang:error(conv_reason(Name, Reason), [Name, Io | Args]); - Other -> - Other - end). - o_request(Io, Request, Func) -> case request(Io, Request) of {error, Reason} -> [_Name | Args] = tuple_to_list(to_tuple(Request)), - {'EXIT',{undef,[_Current|Mfas]}} = (catch erlang:error(undef)), - MFA = {io, Func, [Io | Args]}, - exit({conv_reason(Func, Reason),[MFA|Mfas]}); -% erlang:error(conv_reason(Name, Reason), [Name, Io | Args]); + {'EXIT',{get_stacktrace,[_Current|Mfas]}} = (catch erlang:error(get_stacktrace)), + erlang:raise(error, conv_reason(Func, Reason), [{io, Func, [Io | Args]}|Mfas]); Other -> Other end. -- cgit v1.2.3