当前位置: 首页>>代码示例>>C++>>正文


C++ ExceptionRef::getMessage方法代码示例

本文整理汇总了C++中ExceptionRef::getMessage方法的典型用法代码示例。如果您正苦于以下问题:C++ ExceptionRef::getMessage方法的具体用法?C++ ExceptionRef::getMessage怎么用?C++ ExceptionRef::getMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ExceptionRef的用法示例。


在下文中一共展示了ExceptionRef::getMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: convertToDynamicObject

DynamicObject Exception::convertToDynamicObject(ExceptionRef& e)
{
   DynamicObject dyno;

   dyno["message"] = e->getMessage();
   dyno["type"] = e->getType();

   if(!e->getCause().isNull())
   {
      dyno["cause"] = convertToDynamicObject(e->getCause());
   }

   if(!(*e).mDetails->isNull())
   {
      dyno["details"] = e->getDetails();
   }

   return dyno;
}
开发者ID:zengyuxing007,项目名称:monarch,代码行数:19,代码来源:Exception.cpp

示例2: serviceConnection


//.........这里部分代码省略.........
                 e->isType("monarch.rt.Interrupted"))
         {
            // send 503 Service Unavailable
            const char* html =
               "<html><body><h2>503 Service Unavailable</h2></body></html>";
            resHeader->setStatus(503, "Service Unavailable");
            resHeader->setField("Content-Type", "text/html");
            resHeader->setField("Content-Length", 58);
            resHeader->setField("Connection", "close");
            if((noerror = response->sendHeader()))
            {
               ByteArrayInputStream is(html, 58);
               noerror = response->sendBody(&is);
            }
         }
         // if the exception was not a socket error then send an internal
         // server error response
         else if(!e->isType("monarch.net.Socket", true))
         {
            // send 500 Internal Server Error
            const char* html =
               "<html><body><h2>500 Internal Server Error</h2></body></html>";
            resHeader->setStatus(500, "Internal Server Error");
            resHeader->setField("Content-Type", "text/html");
            resHeader->setField("Content-Length", 60);
            resHeader->setField("Connection", "close");
            if((noerror = response->sendHeader()))
            {
               ByteArrayInputStream is(html, 60);
               noerror = response->sendBody(&is);
            }
         }
         else
         {
            // log socket error
            if(e->getDetails()->hasMember("error"))
            {
               // build error string
               string error;
               DynamicObjectIterator i =
                  e->getDetails()["error"].getIterator();
               while(i->hasNext())
               {
                  error.append(i->next()->getString());
                  if(i->hasNext())
                  {
                     error.push_back(',');
                  }
               }
               MO_CAT_ERROR(MO_HTTP_CAT,
                  "Connection error: ['%s','%s','%s']",
                  e->getMessage(), e->getType(), error.c_str());
            }
            else
            {
               MO_CAT_ERROR(MO_HTTP_CAT,
                  "Connection error: ['%s','%s']",
                  e->getMessage(), e->getType());
            }
         }

         // monitor request error
         if(!mConnectionMonitor.isNull())
         {
            mConnectionMonitor->afterRequestError(
               &hc, request, response, e);
         }
      }

      // monitor request
      if(!mConnectionMonitor.isNull())
      {
         mConnectionMonitor->afterRequest(&hc);
      }

      if(keepAlive && noerror)
      {
         // set keep-alive timeout (defaults to 5 minutes)
         hc.setReadTimeout(1000 * 60 * 5);

         // clear request and response header fields
         reqHeader->clearFields();
         resHeader->clearFields();
         resHeader->clearStatus();
      }
   }

   // clean up request and response
   delete request;
   delete response;

   // monitor connection
   if(!mConnectionMonitor.isNull())
   {
      mConnectionMonitor->afterServicingConnection(&hc);
   }

   // close connection
   hc.close();
}
开发者ID:bsletten,项目名称:monarch,代码行数:101,代码来源:HttpConnectionServicer.cpp


注:本文中的ExceptionRef::getMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。