Try to use Error refactor LOG(FATAL)/CHECK#1067
Try to use Error refactor LOG(FATAL)/CHECK#1067reyoung wants to merge 1 commit intoPaddlePaddle:developfrom
Conversation
|
|
||
| TrainerConfigHelper::TrainerConfigHelper(const std::string &configFilePath) | ||
| TrainerConfigHelper::TrainerConfigHelper( | ||
| const std::string &configFilePath) throw(ErrorPtr &) |
There was a problem hiding this comment.
https://google.github.io/styleguide/cppguide.html#Exceptions
We do not use C++ exceptions
There was a problem hiding this comment.
不过似乎构造函数里的Error,就只能用Exception返回了。。我再想想其他办法。
|
|
||
| #pragma once | ||
|
|
||
| #include <paddle/utils/Error.h> |
There was a problem hiding this comment.
按照 https://google.github.io/styleguide/cppguide.html#Names_and_Order_of_Includes,这里应该写 `#include "paddle/utils/Error.h" 。只有system header files 才用尖括号。
| @@ -0,0 +1,18 @@ | |||
| /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. | |||
| Licensed under the Apache License, Version 2.0 (the "License"); | |||
| @@ -0,0 +1,28 @@ | |||
| /* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. | |||
| Licensed under the Apache License, Version 2.0 (the "License"); | |||
| limitations under the License. */ | ||
|
|
||
| #pragma once | ||
| #include <memory> |
There was a problem hiding this comment.
#pragma 和 #include 之间缺少空行
| #pragma once | ||
| #include <memory> | ||
| #include <string> | ||
| namespace paddle { |
There was a problem hiding this comment.
#include 和 namespace 之间缺少空行
| #include <memory> | ||
| #include <string> | ||
| namespace paddle { | ||
| typedef std::unique_ptr<std::exception> ErrorPtr; |
| #include <string> | ||
| namespace paddle { | ||
| typedef std::unique_ptr<std::exception> ErrorPtr; | ||
| class Error : public std::exception { |
| #include <string> | ||
| namespace paddle { | ||
| typedef std::unique_ptr<std::exception> ErrorPtr; | ||
| class Error : public std::exception { |
There was a problem hiding this comment.
按照C++ style guide的要求,我们不应该使用exceptions,为什么要定义这个exception type?
| }); | ||
| } | ||
|
|
||
| static void logAllUnhandledExceptions() { |
There was a problem hiding this comment.
如果按照style guide不用exceptions的话,貌似也就不需要log exceptions了.
|
Closed due to I will give a better way handle errors. |
* synchronize api_en and api_cn * synchronize api_en and api_cn * synchronize api_en and api_cn * synchronize api_en and api_cn * synchronize api_en and api_cn * synchronize api_en and api_cn * synchronize api_en and api_cn * synchronize api_en and api_cn * synchronize api_en and api_cn * synchronize api_en and api_cn * synchronize api_en and api_cn * synchronize api_en and api_cn * synchronize api_en and api_cn * synchronize api_en and api_cn * synchronize api_en and api_cn * synchronize api_en and api_cn * synchronize api_en and api_cn * synchronize api_en and api_cn * synchronize api_en and api_cn * synchronize api_en and api_cn * synchronize api_en and api_cn * synchronize api_en and api_cn * synchronize api_en and api_cn * synchronize api_en and api_cn * synchronize api_en and api_cn * synchronize api_en and api_cn
No description provided.