1
0
mirror of https://github.com/chylex/TweetDuck.git synced 2025-04-09 06:15:49 +02:00

Add custom exception messages to file reading in PluginBridge

This commit is contained in:
chylex 2016-09-04 04:01:40 +02:00
parent fb3d9e6d6b
commit 6dd2c6678b

View File

@ -73,7 +73,13 @@ public string ReadFile(int token, string path, bool cache){
return cachedContents;
}
return fileCache[fullPath] = File.ReadAllText(fullPath, Encoding.UTF8);
try{
return fileCache[fullPath] = File.ReadAllText(fullPath, Encoding.UTF8);
}catch(FileNotFoundException){
throw new Exception("File not found.");
}catch(DirectoryNotFoundException){
throw new Exception("Directory not found.");
}
}
public void DeleteFile(int token, string path){