Skip to content

Small cleanup fixes #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

noplanman
Copy link

Remove some unused code.
Add clear() method to reset internal conversation variables.
Fix how /sendtochannel command is ended.
Fix exception handling for ConversationDB.

When the command ends, the last step should be to actually "stop" it, not before, as some data already goes lost when stopping the conversation.
@@ -63,7 +64,7 @@ public static function selectConversation($user_id, $chat_id, $limit = null)

$results = $sth->fetchAll(\PDO::FETCH_ASSOC);

} catch (PDOException $e) {
} catch (\Exception $e) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PDOException didn't work?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, unfortunately not 😕

This is the exception I get, which is not caught:

PDOStatement::execute(): SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`telegrambot`.`conversation`, CONSTRAINT `conversation_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`))

I checked the PDO documentation and found that the PDOException is the only exception type available, but the one being thrown is not of that type. If you can find a more specific one to catch that would be great, but I didn't find any...

@MBoretto
Copy link
Owner

ok! I'm merging

MBoretto added a commit that referenced this pull request Mar 13, 2016
@MBoretto MBoretto merged commit 2858ff5 into MBoretto:feature/smartinterface Mar 13, 2016
@noplanman noplanman deleted the small_cleanup_fixes branch March 18, 2016 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants