Skip to content
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

Show exact location on messages' parse errors #68

Open
pietroalbini opened this issue Jun 5, 2016 · 1 comment
Open

Show exact location on messages' parse errors #68

pietroalbini opened this issue Jun 5, 2016 · 1 comment

Comments

@pietroalbini
Copy link
Contributor

If you send a message with rich formatting, but a parsing error in it, Telegram returns just a cryptic message. Fortunately, there is where the error occured, so botogram should display it in a better way.

@pietroalbini
Copy link
Contributor Author

pietroalbini commented Jun 5, 2016

For the implementation, I would like to mimic the SyntaxError behavior. After some research, I found you can do that with:

class MyError(Exception):

    def __init__(self):
        # Standard exception attributes
        self.msg = 'abc'

        # Attributes which mimics the SyntaxError behavior
        self.filename = '<message>'
        self.lineno = 1
        self.offset = 3
        self.text = 'hey'
        self.print_file_and_line = None  # The trick to activate everything

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant