about summary refs log tree commit diff stats
path: root/tcoin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tcoin.cpp')
-rw-r--r--tcoin.cpp29
1 files changed, 19 insertions, 10 deletions
diff --git a/tcoin.cpp b/tcoin.cpp
index 393a2bb..2010af1 100644
--- a/tcoin.cpp
+++ b/tcoin.cpp
@@ -66,6 +66,15 @@
 #define ERR_NEGATIVE_SEND_AMOUNT 2
 #define ERR_INSUFFICIENT_FUNDS 3
 #define ERR_RECEIVER_NOT_FOUND 1
+#define ERR_GET_FILE_VALUE_COULDNT_OPEN_BASEFILE 1
+#define ERR_ADD_FILE_VALUE_COULDNT_OPEN_BASEFILE 1
+#define ERR_ADD_FILE_VALUE_FATAL 999
+#define ERR_GET_FILE_VALUE_COULDNT_OPEN_BASEFILE 1
+#define ERR_ADD_FILE_VALUE_COULDNT_OPEN_BASEFILE 1
+#define ERR_SEND_MESSAGE_RECEIVER_MSG_FILE_UNABLE_TO_BE_UPDATED_FATAL 101
+#define ERR_SEND_MESSAGE_PROGRAM_RECEIVER_MSG_FILE_UNABLE_TO_BE_UPDATED_FATAL 103
+#define ERR_SEND_MESSAGE_SENDER_MSG_FILE_UNABLE_TO_BE_UPDATED_FATAL 102
+
 
 void exit_program(const int error_number)
 {
@@ -213,7 +222,7 @@ long long int get_file_value(const char* file_name)
     if(!strcmp(file_name, "base/base"))
     {
       std::cerr << "\nError! Could not open file at " << file_path << "!\n\n";
-      exit_program(1);
+      exit_program(ERR_GET_FILE_VALUE_COULDNT_OPEN_BASEFILE);
     }
     else
     {
@@ -251,7 +260,7 @@ int add_file_value(const char* file_name, const long long int &value_to_add, con
       file.close();
       delete[] file_path;
       delete[] temp_file_path;
-      exit_program(1);
+      exit_program(ERR_ADD_FILE_VALUE_COULDNT_OPEN_BASEFILE);
     }
   }
 
@@ -281,8 +290,8 @@ int add_file_value(const char* file_name, const long long int &value_to_add, con
 
   if(!file2) //error
   {
-    std::cerr << "Fatal error 999: the file \"" << file_name << "\" was unable to be updated. Please contact login@tilde.town (town-only) or login@tilde.team (internet-wide to report this error (because it requires manual recovery).";
-    exit_program(999);
+    std::cerr << "Fatal error " << ERR_ADD_FILE_VALUE_FATAL << ": the file \"" << file_name << "\" was unable to be updated. Please contact login@tilde.town (town-only) or login@tilde.team (internet-wide to report this error (because it requires manual recovery).";
+    exit_program(ERR_ADD_FILE_VALUE_FATAL);
   }
   else
   {
@@ -993,8 +1002,8 @@ int send_message(const char* sender_username, const char* receiver_username, con
 
       if(!fout) //error
       {
-        std::cerr << "Fatal error 101: the receiver message file was unable to be updated. Please contact login@tilde.town (town-only) or login@tilde.team (internet-wide to report this error (because it requires manual recovery).";
-        exit_program(101);
+        std::cerr << "Fatal error" << ERR_SEND_MESSAGE_RECEIVER_MSG_FILE_UNABLE_TO_BE_UPDATED_FATAL << ": the receiver message file was unable to be updated. Please contact login@tilde.town (town-only) or login@tilde.team (internet-wide to report this error (because it requires manual recovery).";
+        exit_program(ERR_SEND_MESSAGE_RECEIVER_MSG_FILE_UNABLE_TO_BE_UPDATED_FATAL);
       }
       else
       {
@@ -1082,8 +1091,8 @@ int send_message(const char* sender_username, const char* receiver_username, con
 
             if(!fout) //error
             {
-              std::cerr << "Fatal error 103: the receiver program_message file was unable to be updated. Please contact login@tilde.town (town-only) or login@tilde.team (internet-wide to report this error (because it requires manual recovery).";
-              exit_program(103);
+              std::cerr << "Fatal error " << ERR_SEND_MESSAGE_PROGRAM_RECEIVER_MSG_FILE_UNABLE_TO_BE_UPDATED_FATAL << ": the receiver program_message file was unable to be updated. Please contact login@tilde.town (town-only) or login@tilde.team (internet-wide to report this error (because it requires manual recovery).";
+              exit_program(ERR_SEND_MESSAGE_PROGRAM_RECEIVER_MSG_FILE_UNABLE_TO_BE_UPDATED_FATAL);
             }
             else
             {
@@ -1176,8 +1185,8 @@ int send_message(const char* sender_username, const char* receiver_username, con
 
           if(!fout) //error
           {
-            std::cerr << "Fatal error 102: the sender message file was unable to be updated. Please contact login@tilde.town (town-only) or login@tilde.team (internet-wide to report this error (because it requires manual recovery).";
-            exit_program(102);
+            std::cerr << "Fatal error " << ERR_SEND_MESSAGE_SENDER_MSG_FILE_UNABLE_TO_BE_UPDATED_FATAL << ": the sender message file was unable to be updated. Please contact login@tilde.town (town-only) or login@tilde.team (internet-wide to report this error (because it requires manual recovery).";
+            exit_program(ERR_SEND_MESSAGE_SENDER_MSG_FILE_UNABLE_TO_BE_UPDATED_FATAL);
           }
           else
           {