diff --git a/libsass_src/src/file.cpp b/libsass_src/src/file.cpp index 163abd4..ff6dfa3 100644 --- a/libsass_src/src/file.cpp +++ b/libsass_src/src/file.cpp @@ -26,6 +26,7 @@ #include "util.hpp" #include "util_string.hpp" #include "sass2scss.h" +#include #ifdef _WIN32 # include @@ -478,7 +479,9 @@ namespace Sass { struct stat st; if (stat(path.c_str(), &st) == -1 || S_ISDIR(st.st_mode)) return 0; FILE* fd = std::fopen(path.c_str(), "rb"); - if (fd == nullptr) return nullptr; + if (fd == nullptr) { + throw Exception::OperationError("error reading file \"" + path + "\": " + strerror(errno)); + } const std::size_t size = st.st_size; char* contents = static_cast(malloc(st.st_size + 2 * sizeof(char))); if (std::fread(static_cast(contents), 1, size, fd) != size) {