title: Catching const char* exception in c++
body: <p>I make an exception for my program:</p>
  
  <pre><code>class PortNotDefined: public exception
  {
  public:
  
  const char* what() const throw()
  {
      return "Puerto no definido o no disponible";
  }
  } PortNotDefined;
  </code></pre>
  
  <p>And later, I use a try-catch block like this:</p>
  
  <pre><code>try{.....}
  catch(const char* a){
      std::string error(a);
      ...
  }
  </code></pre>
  
  <p>But it not catch the exception, I dont know if I defined well the exception or is problem in the try-catch</p>
  
  <p>Thanks for your time^^</p>