File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -131,7 +131,12 @@ public struct BitBlob (size_t Bits)
131131
132132 public this (scope const ubyte [] bin, bool isLE = true )
133133 {
134- assert (bin.length == Width);
134+ enum W = Width; // Make sure the value is shown, not the symbol
135+ if (bin.length != Width)
136+ assert (0 , " ubyte[] argument to " ~ typeof (this ).stringof
137+ ~ " constructor does not match the expected size of "
138+ ~ W.stringof);
139+
135140 this .data[] = bin[];
136141 if (! isLE)
137142 {
@@ -161,7 +166,9 @@ public struct BitBlob (size_t Bits)
161166
162167 public this (scope const (char )[] hexstr)
163168 {
164- enum ErrorMsg = " Wrong string size passed to ctor" ;
169+ enum W = Width; // Make sure the value is shown, not the symbol
170+ enum ErrorMsg = " Length of string passed to " ~ typeof (this ).stringof
171+ ~ " constructor does not match the expected size of " ~ W.stringof;
165172 if (hexstr.length == (Width * 2 ) + " 0x" .length)
166173 {
167174 assert (hexstr[0 ] == ' 0' , ErrorMsg);
You can’t perform that action at this time.
0 commit comments