File tree 3 files changed +12
-20
lines changed
3 files changed +12
-20
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ version: 0.15.0
4
4
dependencies :
5
5
db :
6
6
github : crystal-lang/crystal-db
7
- version : ~> 0.12.0
7
+ version : ~> 0.13.1
8
8
9
9
authors :
10
10
-
Juan Wajnerman <[email protected] >
Original file line number Diff line number Diff line change @@ -12,8 +12,8 @@ class MySql::ReadPacket < IO
12
12
io.read_fully(header.to_slice)
13
13
@length = @remaining = header[0 ].to_i + (header[1 ].to_i << 8 ) + (header[2 ].to_i << 16 )
14
14
@seq = header[3 ]
15
- rescue IO ::EOFError
16
- raise DB ::ConnectionLost .new(@connection )
15
+ rescue e : IO ::EOFError
16
+ raise DB ::ConnectionLost .new(@connection , cause: e )
17
17
end
18
18
end
19
19
@@ -26,8 +26,8 @@ class MySql::ReadPacket < IO
26
26
read_bytes = @io .read_fully(slice)
27
27
@remaining -= read_bytes
28
28
read_bytes
29
- rescue IO ::EOFError
30
- raise DB ::ConnectionLost .new(@connection )
29
+ rescue e : IO ::EOFError
30
+ raise DB ::ConnectionLost .new(@connection , cause: e )
31
31
end
32
32
33
33
{% if compare_versions(Crystal ::VERSION , " 0.35.0" ) == 0 % }
Original file line number Diff line number Diff line change @@ -6,19 +6,11 @@ class MySql::WritePacket < IO
6
6
raise " not implemented"
7
7
end
8
8
9
- {% if compare_versions(Crystal ::VERSION , " 0.35.0" ) == 0 % }
10
- def write (slice ) : Int64
11
- @io .write(slice)
12
- rescue IO ::EOFError
13
- raise DB ::ConnectionLost .new(@connection )
14
- end
15
- {% else % }
16
- def write (slice ) : Nil
17
- @io .write(slice)
18
- rescue IO ::EOFError
19
- raise DB ::ConnectionLost .new(@connection )
20
- end
21
- {% end % }
9
+ def write (slice ) : Nil
10
+ @io .write(slice)
11
+ rescue e : IO ::EOFError
12
+ raise DB ::ConnectionLost .new(@connection , cause: e)
13
+ end
22
14
23
15
def write_lenenc_string (s : String )
24
16
write_lenenc_int(s.bytesize)
@@ -44,8 +36,8 @@ class MySql::WritePacket < IO
44
36
45
37
def write_string (s : String )
46
38
@io << s
47
- rescue IO ::EOFError
48
- raise DB ::ConnectionLost .new(@connection )
39
+ rescue e : IO ::EOFError
40
+ raise DB ::ConnectionLost .new(@connection , cause: e )
49
41
end
50
42
51
43
def write_blob (v : Bytes )
You can’t perform that action at this time.
0 commit comments