evancz/Elm — pull request #290 by jsl (2013-10-11 19:00:15+00:00)
Title: Improve error messages when elm input file or binary can't be found

When the elm binary can't be found or the requested file ends in .elm but the
file does not exist the server returns the following unhelpful message:

Server error: elm-server-cache: getDirectoryContents: does not exist (No such file or directory)

This error occurs because the server tries to call removeDirectoryRecursive
on a directory that doesn't exist. This PR adds a check to make sure the
directory exists before removing it, and it also adds a case to check if the
error code is 127. I added this case because there is no useful stderr nor
stdout in this case, so it seems better to return a custom message since we
know the cause of the 127 code.