aboutsummaryrefslogtreecommitdiffstats
path: root/lib/typer
diff options
context:
space:
mode:
authorStavros Aronis <[email protected]>2011-09-28 09:04:04 +0300
committerStavros Aronis <[email protected]>2011-09-28 09:08:25 +0300
commite4d5a206975e7718f6a95d5610ddc45b1d801c49 (patch)
treea3308fd176c3969959135d798ef7fbf0dc3b0f00 /lib/typer
parent39a3e0aa40eb75f5780c4c0964343c046955adec (diff)
downloadotp-e4d5a206975e7718f6a95d5610ddc45b1d801c49.tar.gz
otp-e4d5a206975e7718f6a95d5610ddc45b1d801c49.tar.bz2
otp-e4d5a206975e7718f6a95d5610ddc45b1d801c49.zip
Fix typer's crash for nonexisting files
... and do some small cleanups.
Diffstat (limited to 'lib/typer')
-rw-r--r--lib/typer/src/typer.erl12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/typer/src/typer.erl b/lib/typer/src/typer.erl
index e40c4f39cd..16ef7f03c2 100644
--- a/lib/typer/src/typer.erl
+++ b/lib/typer/src/typer.erl
@@ -466,14 +466,20 @@ write_typed_file(File, Info) ->
case file:make_dir(TyperAnnDir) of
{error, Reason} ->
case Reason of
- eexist -> %% TypEr dir exists; remove old typer files
- ok = file:delete(NewFileName),
+ eexist -> %% TypEr dir exists; remove old typer files if they exist
+ case file:delete(NewFileName) of
+ ok -> ok;
+ {error, enoent} -> ok;
+ {error, _} ->
+ Msg = io_lib:format("Error in deleting file ~s\n", [NewFileName]),
+ fatal_error(Msg)
+ end,
write_typed_file(File, Info, NewFileName);
enospc ->
Msg = io_lib:format("Not enough space in ~p\n", [Dir]),
fatal_error(Msg);
eacces ->
- Msg = io:format("No write permission in ~p\n", [Dir]),
+ Msg = io_lib:format("No write permission in ~p\n", [Dir]),
fatal_error(Msg);
_ ->
Msg = io_lib:format("Unhandled error ~s when writing ~p\n",