Commit cfe83db0 authored by Joris Vankerschaver's avatar Joris Vankerschaver

Fix IOError format string when opening non-existent file

parent 376e2b98
......@@ -211,7 +211,7 @@ Box* open(Box* arg1, Box* arg2) {
FILE* f = fopen(fn.c_str(), mode.c_str());
if (!f)
raiseExcHelper(IOError, "%s: '%s' '%s'", strerror(errno), fn.c_str());
raiseExcHelper(IOError, "[Error %d] %s: '%s'", errno, strerror(errno), fn.c_str());
return new BoxedFile(f, fn, mode);
}
......
......@@ -39,3 +39,8 @@ with open('../README.md') as f:
print lines[:5]
print lines[-5:]
# Check that opening a non-existent file results in an IOError.
try:
f = open('this-should-definitely-not-exist.txt')
except IOError as e:
print str(e)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment