Changeset 67c3cdbee0ef6f0708dfe5bf5343ae8b75b33610

Show
Ignore:
Timestamp:
08/22/10 21:55:48 (21 months ago)
Author:
Antti-Juhani Kaijanaho <antti-juhani@…>
Children:
050d01b46d7ee14f1bfef6a452898e0928dea949
Parents:
563ece2aeca700b9245bc2ac709c7fd346fea911
git-committer:
Antti-Juhani Kaijanaho <antti-juhani@…> (08/22/10 21:55:48)
Message:

[nntp::connection] Catch exceptions from command handlers

This will mitigate, if not solve, #68.

Signed-off-by: Antti-Juhani Kaijanaho <antti-juhani@…>

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • nntp/connection.cc

    rae733bf r67c3cdb  
    316316                        if (!arg.empty()) args.push_back(arg); 
    317317                } 
    318                 continuation::ptr cont =  
    319                         it->second->perform(cp->shared_from_this(), 
    320                                             args.data(), args.size()); 
     318                continuation::ptr cont; 
     319                try 
     320                { 
     321                        cont = it->second->perform(cp->shared_from_this(), 
     322                                                   args.data(), args.size()); 
     323                } 
     324                catch (std::exception &e) 
     325                { 
     326                        logger::logline ll; 
     327                        ll << cp->loghead 
     328                           << "exception caught: " 
     329                           << e.what() 
     330                           << " (" << typeid(e).name() << ")"; 
     331                        ll.close(); 
     332                        cp->writebuf.clear(); 
     333                        cp->send_line("403 server error, please try again"); 
     334                        cont = shared_from_this(); 
     335                } 
    321336                cp->flush_writebuf(cont); 
    322337        }