diff options
author | Björn-Egil Dahlberg <[email protected]> | 2011-02-10 14:23:20 +0100 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2011-02-10 14:23:20 +0100 |
commit | 6f260c38ce2a75d86dbd4348e973ffca629d331b (patch) | |
tree | a5d0286f8ebf8934cbeb8f1e5b396049f7f1005e /lib/stdlib/src/io.erl | |
parent | a7ff13dc99a9e83e70ab44c011c184109346fcc3 (diff) | |
download | otp-6f260c38ce2a75d86dbd4348e973ffca629d331b.tar.gz otp-6f260c38ce2a75d86dbd4348e973ffca629d331b.tar.bz2 otp-6f260c38ce2a75d86dbd4348e973ffca629d331b.zip |
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
Diffstat (limited to 'lib/stdlib/src/io.erl')
-rw-r--r-- | lib/stdlib/src/io.erl | 18 |
1 files changed, 2 insertions, 16 deletions
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. |