Added custom errors, fixes to code generator

The code generator now handles okay the flags using True type
Also, double checking for the flag is now avoided in cases where the
flag was a Vector type
This commit is contained in:
Lonami
2016-09-05 18:35:12 +02:00
parent b027dd2c8f
commit 251c1830a5
12 changed files with 170 additions and 110 deletions

View File

@@ -2,6 +2,7 @@
# https://github.com/sochix/TLSharp/blob/master/TLSharp.Core/Network/TcpTransport.cs
from network import TcpMessage, TcpClient
from binascii import crc32
from errors import *
class TcpTransport:
@@ -42,7 +43,7 @@ class TcpTransport:
valid_checksum = crc32(rv)
if checksum != valid_checksum:
raise ValueError('Invalid checksum, skip')
raise InvalidChecksumError(checksum, valid_checksum)
# If we passed the tests, we can then return a valid TcpMessage
return TcpMessage(seq, body)