Skip to content

Commit

Permalink
Confusing error message.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkskeller committed Jan 23, 2018
1 parent 22c28a7 commit 5e49441
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
13 changes: 12 additions & 1 deletion Exceptions/Exceptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,18 @@ class crash_requested: public exception
};
class memory_exception : public exception {};
class how_would_that_work : public exception {};

class not_enough_to_buffer : public runtime_error
{
public:
not_enough_to_buffer(string type) :
runtime_error(
"Not enough data available for buffer. "
"Maybe insufficient preprocessing" + type
+ ".\nFor benchmarking, you can activate reusing data by "
"adding -DINSECURE to the compiler options.")
{
}
};


#endif
3 changes: 1 addition & 2 deletions Processor/Buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ void BufferBase::try_rewind()
string type;
if (field_type and data_type)
type = (string)" of " + field_type + " " + data_type;
throw runtime_error("Insufficient preprocessing" + type + ".\nFor benchmarking, "
"you can activate reusing data by adding -DINSECURE to the compiler options.");
throw not_enough_to_buffer(type);
#endif
file->clear(); // unset EOF flag
file->seekg(0);
Expand Down
9 changes: 8 additions & 1 deletion Processor/Input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,14 @@ void Input<T>::start(int player, int n_inputs)
Share<T>& share = shares[player][i];
proc.DataF.get_input(share, rr, player);
T xi;
buffer.input(t);
try
{
buffer.input(t);
}
catch (not_enough_to_buffer& e)
{
throw runtime_error("Insufficient input data to buffer");
}
t.sub(t, rr);
t.pack(o);
xi.add(t, share.get_share());
Expand Down

0 comments on commit 5e49441

Please sign in to comment.