This repository was archived by the owner on Nov 24, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Expand file tree Collapse file tree 3 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ serde = "1.0"
21
21
serde_json = " 1.0"
22
22
serde_derive = " 1.0"
23
23
failure = " 0.1.1"
24
+ log = " 0.4.1"
24
25
25
26
[dev-dependencies ]
26
27
duct = " 0.8.2"
Original file line number Diff line number Diff line change 1
1
#[ macro_use]
2
+ extern crate log;
3
+ #[ macro_use]
2
4
extern crate failure;
3
5
#[ cfg( test) ]
4
6
#[ macro_use]
Original file line number Diff line number Diff line change @@ -89,8 +89,23 @@ impl Data {
89
89
. iter ( )
90
90
. position ( |p| p. start <= from && p. end >= up_to_and_including)
91
91
. ok_or_else ( || {
92
+ use log:: Level :: Debug ;
93
+ if log_enabled ! ( Debug ) {
94
+ let slices = self . parts
95
+ . iter ( )
96
+ . map ( |p| ( p. start , p. end , match p. data {
97
+ State :: Initial => "initial" ,
98
+ State :: Replaced ( ..) => "replaced" ,
99
+ } ) )
100
+ . collect :: < Vec < _ > > ( ) ;
101
+ debug ! ( "no single slice covering {}...{}, current slices: {:?}" ,
102
+ from, up_to_and_including, slices,
103
+ ) ;
104
+ }
105
+
92
106
format_err ! (
93
- "Could not find data slice that covers range {}..{}" ,
107
+ "Could not replace range {}...{} in file \
108
+ -- maybe parts of it were already replaced?",
94
109
from,
95
110
up_to_and_including
96
111
)
You can’t perform that action at this time.
0 commit comments