Fix unhandled exception when authurl path is non-existent (#2456)

* Catch an unhandled exception when the user sets the authurl file to a location that cannot be accessed
This commit is contained in:
abraunegg 2023-07-23 10:13:03 +10:00 committed by GitHub
parent 94ccb7a6d0
commit fb0a5f0796
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -586,9 +586,19 @@ final class OneDriveApi
string[] authFiles = authFilesString.split(":");
string authUrl = authFiles[0];
string responseUrl = authFiles[1];
auto authUrlFile = File(authUrl, "w");
authUrlFile.write(url);
authUrlFile.close();
try {
// Try and write out the auth URL to the nominated file
auto authUrlFile = File(authUrl, "w");
authUrlFile.write(url);
authUrlFile.close();
} catch (std.exception.ErrnoException e) {
// There was a file system error
// display the error message
displayFileSystemErrorMessage(e.msg, getFunctionName!({}));
return false;
}
while (!exists(responseUrl)) {
Thread.sleep(dur!("msecs")(100));
}