Skip to content

Commit

Permalink
Make hash enum function errors more descriptive
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-zw committed Jun 28, 2021
1 parent 12259be commit 5b276ee
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libiop/bcs/hashing/hash_enum.tcc
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ std::shared_ptr<hashchain<FieldT, MT_root_type>> get_hashchain_internal(
{
return std::make_shared<blake2b_hashchain<FieldT, MT_root_type>>(security_parameter);
}
throw std::invalid_argument("bcs_hash_type unknown");
throw std::invalid_argument("bcs_hash_type unknown (blake2b hashchain)");
}


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

/* Algebraic leafhash case */
Expand Down Expand Up @@ -125,7 +125,7 @@ two_to_one_hash_function<hash_type> get_two_to_one_hash_internal(
{
return blake2b_two_to_one_hash;
}
throw std::invalid_argument("bcs_hash_type unknown");
throw std::invalid_argument("bcs_hash_type unknown (blake2b two to one hash)");
}

/* algebraic 2->1 hash */
Expand Down Expand Up @@ -174,7 +174,7 @@ cap_hash_function<hash_type> get_cap_hash_internal(
{
return blake2b_many_to_one_hash;
}
throw std::invalid_argument("bcs_hash_type unknown");
throw std::invalid_argument("bcs_hash_type unknown (blake2b cap hash)");
}

/* Algebraic 2^n->1 hash. */
Expand Down

0 comments on commit 5b276ee

Please sign in to comment.