How to implement a correct (intelligent) bad end?

cesario678

Client
Регистрация
10.03.2022
Сообщения
182
Благодарностей
13
Баллы
18
I have a rather large bot, and I usually implement a "bad end" scenario when it encounters an error, returning the data back to a table. However, my bot is extensive and reads information from the tables at the beginning, middle, and end of its operations. If I use a bad end in case of an error, it will return the data already used, as well as the data that hasn't been used yet, which could cause problems.
Can anyone provide insight into the best way to return the data to the table so that only the used data is returned, while unused data is not included in the file, avoiding duplication? Thanks in advance!
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 814
Благодарностей
1 188
Баллы
113
It is hard to suggest anything because every situation is different. But one thing I see in your post "large bot". It is always better to split large bot into two or more parts. It should make your life much easier.

When you save data back in file, you can add that data status like: My Initial data + Used then next time when you take this like its used,. You can also add different status messages like MiddleFail, EndFail etc.

Not sure what you mean about duplication, but when you take your data from file you delete it as you take, so there cant be any duplicates in file.

You can also save some data in different files. Hope that helps
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)