Skip to content

Commit 6f819da

Browse files
committed
Make hash enum function errors more descriptive
1 parent 0934874 commit 6f819da

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

libiop/bcs/hashing/hash_enum.tcc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ std::shared_ptr<hashchain<FieldT, MT_root_type>> get_hashchain_internal(
5858
{
5959
return std::make_shared<blake2b_hashchain<FieldT, MT_root_type>>(security_parameter);
6060
}
61-
throw std::invalid_argument("bcs_hash_type unknown");
61+
throw std::invalid_argument("bcs_hash_type unknown (blake2b hashchain)");
6262
}
6363

6464

@@ -80,7 +80,7 @@ std::shared_ptr<leafhash<FieldT, leaf_hash_type>> get_leafhash_internal(
8080
{
8181
return std::make_shared<blake2b_leafhash<FieldT>>(security_parameter);
8282
}
83-
throw std::invalid_argument("bcs_hash_type unknown");
83+
throw std::invalid_argument("bcs_hash_type unknown (blake2b leaf hash)");
8484
}
8585

8686
/* Algebraic leafhash case */
@@ -125,7 +125,7 @@ two_to_one_hash_function<hash_type> get_two_to_one_hash_internal(
125125
{
126126
return blake2b_two_to_one_hash;
127127
}
128-
throw std::invalid_argument("bcs_hash_type unknown");
128+
throw std::invalid_argument("bcs_hash_type unknown (blake2b two to one hash)");
129129
}
130130

131131
/* algebraic 2->1 hash */
@@ -174,7 +174,7 @@ cap_hash_function<hash_type> get_cap_hash_internal(
174174
{
175175
return blake2b_many_to_one_hash;
176176
}
177-
throw std::invalid_argument("bcs_hash_type unknown");
177+
throw std::invalid_argument("bcs_hash_type unknown (blake2b cap hash)");
178178
}
179179

180180
/* Algebraic 2^n->1 hash. */

0 commit comments

Comments
 (0)