mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-04-28 10:09:54 +03:00
Handle guild data load errors better (#172)
Previously, any errors in guild data load will cause the bot to be unusable in that guild. It didn't help that the end users had no information that something was wrong! Now, any errors will be logged better (with the full path to the file that couldn't be loaded), and the users will receive a message saying that functionality is degraded The old way to save objects was to serialize them directly into streams opened by `File#Create`. This can cause problems if the serialization isn't completed, because `File#Create` overwrites the file with an empty one on the spot. Now, objects are first deserialized into a temporary file, then the original is replaced by the temporary, then the temporary is deleted. Errors during guild data load would sometimes cause the bot to replace the corrupted file with a default one whenever a save is triggered. Now, guilds with load errors won't have their data saved to aid in debugging --------- Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com> Signed-off-by: mctaylors <mctaylxrs@outlook.com>
This commit is contained in:
parent
fb3aebb1e0
commit
cf7007f269
8 changed files with 142 additions and 28 deletions
|
@ -570,6 +570,12 @@
|
|||
<data name="MessagesClearedFiltered" xml:space="preserve">
|
||||
<value>Cleared {0} messages from {1}</value>
|
||||
</data>
|
||||
<data name="DataLoadFailedTitle" xml:space="preserve">
|
||||
<value>An error occurred during guild data load.</value>
|
||||
</data>
|
||||
<data name="DataLoadFailedDescription" xml:space="preserve">
|
||||
<value>This will lead to unexpected behavior. Data will no longer be saved</value>
|
||||
</data>
|
||||
<data name="CommandExecutionFailed" xml:space="preserve">
|
||||
<value>An error occurred during command execution, try again later.</value>
|
||||
</data>
|
||||
|
|
|
@ -570,6 +570,12 @@
|
|||
<data name="MessagesClearedFiltered" xml:space="preserve">
|
||||
<value>Очищено {0} сообщений от {1}</value>
|
||||
</data>
|
||||
<data name="DataLoadFailedTitle" xml:space="preserve">
|
||||
<value>Произошла ошибка при загрузке данных сервера.</value>
|
||||
</data>
|
||||
<data name="DataLoadFailedDescription" xml:space="preserve">
|
||||
<value>Это может привести к неожиданному поведению. Данные больше не будут сохраняться.</value>
|
||||
</data>
|
||||
<data name="CommandExecutionFailed" xml:space="preserve">
|
||||
<value>Произошла ошибка при выполнении команды, повтори попытку позже.</value>
|
||||
</data>
|
||||
|
|
|
@ -570,6 +570,12 @@
|
|||
<data name="MessagesClearedFiltered" xml:space="preserve">
|
||||
<value>вырезано {0} забавных сообщений от {1}</value>
|
||||
</data>
|
||||
<data name="DataLoadFailedTitle" xml:space="preserve">
|
||||
<value>произошёл тотальный разнос в гилддате.</value>
|
||||
</data>
|
||||
<data name="DataLoadFailedDescription" xml:space="preserve">
|
||||
<value>возможно всё съедет с крыши, но знай, что я больше ничё не сохраню.</value>
|
||||
</data>
|
||||
<data name="CommandExecutionFailed" xml:space="preserve">
|
||||
<value>произошёл тотальный разнос в команде, удачи.</value>
|
||||
</data>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue