Revert handle and add logging

Server.ts isn't actually printing the error to the user anyways so there was no point in trying to fix it
This commit is contained in:
Thoronium 2023-02-26 03:02:52 -07:00 committed by GitHub
parent d49fdacf2a
commit 088d007816
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View File

@ -130,7 +130,15 @@ pub fn read_file(path: String) -> String {
let mut file = match fs::File::open(path_buf) {
Ok(file) => file,
Err(e) => return String.from::(""); // Send back error for handling by the caller
Err(e) => {
if path.contains("config") {
// Server.ts won't print the error so handle the message here for the user
println!("Server config not found or invalid. Be sure to run the server at least once to generate it before making edits.");
} else {
println!("Failed to open file: {}", e);
}
return String::new(); // Send back error for handling by the caller
}
};
let mut contents = String::new();

View File

@ -40,11 +40,5 @@ export async function encryptionEnabled(path: string) {
return false
}
// Also check if null just in case
if (serverConf == null) {
console.log(`Server config at ${path} not found or invalid. Be sure to run the server at least once to generate it`)
return false
}
return serverConf.server.http.encryption.useEncryption
}