Yepessin / slb

Automatically exported from code.google.com/p/slb
0 stars 0 forks source link

Default error handler doesn't clear the buffer #14

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run the script with a syntax error
2. See the description you receive with std::exception 
3. Run it again 
4. See the description now contains doubled description
...
N. See how description becomes extremely huge.

What version of the product are you using? On what operating system?

SLB 2.0b

Fix:

To fix you need to clear the stream and set an empty string
void DefaultErrorHandler::begin(const char *error)
{
  _out.clear();
  _out.str(""); //<<<<<< Add this line to fix it.

Works fine for me now. 
For references see 
http://stackoverflow.com/questions/624260/how-to-reuse-an-ostringstream

Original issue reported on code.google.com by sergey.p...@gmail.com on 25 Jan 2012 at 3:23

GoogleCodeExporter commented 8 years ago
Thanks for de deailed report, I will fix it as you suggest. 

Original comment by joseLuis...@gmail.com on 25 Jan 2012 at 3:26

GoogleCodeExporter commented 8 years ago

Original comment by joseLuis...@gmail.com on 2 Feb 2012 at 5:27