mtproto icon indicating copy to clipboard operation
mtproto copied to clipboard

Should remove the panic?

Open waybackarchiver opened this issue 4 years ago • 3 comments

The panic in this code looks like used for debugging. I guess that should remove it?

https://github.com/xelaj/mtproto/blob/04ee89d1b6bce00fb50e4e87bf16fdc781cf4d8f/mtproto.go#L364-L367

waybackarchiver avatar Aug 06 '21 15:08 waybackarchiver

@waybackarchiver well, yes, but no. BadMsgNotification means that all session was broken, i mean, this message should be never received from official telegram servers. if we got it, then something in package is broken.

Soooo, idk, maybe we need to leave for now... Or remove it, cause i hate panics in community modules too...

I don't know, need to decide what to do with it.

quenbyako avatar Aug 16 '21 11:08 quenbyako

As I understand it, we should provide this panic as an error to the caller to handling, and not have them interrupted.

But I haven't encountered this yet, so maybe I'll consider it later if we need to.

waybackarchiver avatar Aug 16 '21 14:08 waybackarchiver

return error (or mark session is in bad state) and let app decide what to do (panic or reconnect/recreate session). at this time I've been forced to separate app logic using different processes because of mtproto panics (lost connection/BadMsgNotification whatever)

sunnyque avatar Aug 18 '21 09:08 sunnyque