@@ -45,15 +45,15 @@ def __bool__(self) -> bool:
4545 def key (self ) -> algopy .Bytes :
4646 """Provides access to the raw storage key"""
4747 if not self ._key :
48- raise ValueError ("Box key is empty" )
48+ raise RuntimeError ("Box key is empty" )
4949 return self ._key
5050
5151 @property
5252 def value (self ) -> _TValue :
5353 """Retrieve the contents of the box. Fails if the box has not been created."""
5454 context = get_test_context ()
5555 if not context .does_box_exist (self .key ):
56- raise ValueError ("Box has not been created" )
56+ raise RuntimeError ("Box has not been created" )
5757 return _cast_to_value_type (self ._type , context .get_box (self .key ))
5858
5959 @value .setter
@@ -100,7 +100,7 @@ def length(self) -> algopy.UInt64:
100100
101101 context = get_test_context ()
102102 if not context .does_box_exist (self .key ):
103- raise ValueError ("Box has not been created" )
103+ raise RuntimeError ("Box has not been created" )
104104 return algopy .UInt64 (len (context .get_box (self .key )))
105105
106106
@@ -129,7 +129,7 @@ def __bool__(self) -> bool:
129129 def key (self ) -> algopy .Bytes :
130130 """Provides access to the raw storage key"""
131131 if not self ._key :
132- raise ValueError ("Box key is empty" )
132+ raise RuntimeError ("Box key is empty" )
133133
134134 return self ._key
135135
@@ -178,7 +178,7 @@ def extract(
178178 start_int = int (start_index )
179179 length_int = int (length )
180180 if not box_exists :
181- raise ValueError ("Box does not exist " )
181+ raise RuntimeError ("Box has not been created " )
182182 if (start_int + length_int ) > len (box_content ):
183183 raise ValueError ("Index out of bounds" )
184184 result = box_content [start_int : start_int + length_int ]
@@ -198,7 +198,7 @@ def resize(self, new_size: algopy.UInt64 | int) -> None:
198198 raise ValueError (f"Box size cannot exceed { MAX_BOX_SIZE } " )
199199 box_content , box_exists = self ._maybe ()
200200 if not box_exists :
201- raise ValueError ("Box has not been created" )
201+ raise RuntimeError ("Box has not been created" )
202202 if new_size_int > len (box_content ):
203203 updated_content = box_content + b"\x00 " * (new_size_int - len (box_content ))
204204 else :
@@ -216,7 +216,7 @@ def replace(self, start_index: algopy.UInt64 | int, value: algopy.Bytes | bytes)
216216 context = get_test_context ()
217217 box_content , box_exists = self ._maybe ()
218218 if not box_exists :
219- raise ValueError ("Box has not been created" )
219+ raise RuntimeError ("Box has not been created" )
220220 start = int (start_index )
221221 length = len (value )
222222 if (start + length ) > len (box_content ):
@@ -252,7 +252,7 @@ def splice(
252252 insert_content = value .value if isinstance (value , algopy .Bytes ) else value
253253
254254 if not box_exists :
255- raise ValueError ("Box has not been created" )
255+ raise RuntimeError ("Box has not been created" )
256256
257257 if start > len (box_content ):
258258 raise ValueError ("Start index exceeds box size" )
@@ -329,7 +329,7 @@ def length(self) -> algopy.UInt64:
329329
330330 box_content , box_exists = self ._maybe ()
331331 if not box_exists :
332- raise ValueError ("Box has not been created" )
332+ raise RuntimeError ("Box has not been created" )
333333 return algopy .UInt64 (len (box_content ))
334334
335335
@@ -371,7 +371,7 @@ def __init__(
371371 def key_prefix (self ) -> algopy .Bytes :
372372 """Provides access to the raw storage key-prefix"""
373373 if not self ._key_prefix :
374- raise ValueError ("Box key prefix is empty" )
374+ raise RuntimeError ("Box key prefix is empty" )
375375 return self ._key_prefix
376376
377377 def __getitem__ (self , key : _TKey ) -> _TValue :
@@ -380,7 +380,7 @@ def __getitem__(self, key: _TKey) -> _TValue:
380380 """
381381 box_content , box_exists = self .maybe (key )
382382 if not box_exists :
383- raise ValueError ("Box has not been created" )
383+ raise RuntimeError ("Box has not been created" )
384384 return box_content
385385
386386 def __setitem__ (self , key : _TKey , value : _TValue ) -> None :
@@ -442,7 +442,7 @@ def length(self, key: _TKey) -> algopy.UInt64:
442442 key_bytes = self ._full_key (key )
443443 box_exists = context .does_box_exist (key_bytes )
444444 if not box_exists :
445- raise ValueError ("Box has not been created" )
445+ raise RuntimeError ("Box has not been created" )
446446 box_content_bytes = context .get_box (key_bytes )
447447 return algopy .UInt64 (len (box_content_bytes ))
448448
0 commit comments