void Xhr(ObjectInstance href, ObjectInstance type, FunctionInstance callback, FunctionInstance errorCallback) { var filename = href.ToString(); var referencingFile = currentFiles.Peek(); try { var file = referencingFile.Directory.GetFile(filename); var content = file.OpenRead().ReadToEnd(); callback.Call(Null.Value, content, DateTime.MinValue); } catch (FileNotFoundException ex) { throw FileNotFoundExceptionWithSourceFilename(referencingFile, ex); } catch (DirectoryNotFoundException ex) { throw DirectoryNotFoundExceptionWithSourceFilename(referencingFile, ex); } }