-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try to use Error refactor LOG(FATAL)/CHECK #1067
Conversation
@@ -38,7 +38,8 @@ struct TrainerConfigHelperPrivate { | |||
TrainerConfig conf; | |||
}; | |||
|
|||
TrainerConfigHelper::TrainerConfigHelper(const std::string &configFilePath) | |||
TrainerConfigHelper::TrainerConfigHelper( | |||
const std::string &configFilePath) throw(ErrorPtr &) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://google.github.io/styleguide/cppguide.html#Exceptions
We do not use C++ exceptions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不过似乎构造函数里的Error,就只能用Exception返回了。。我再想想其他办法。
@@ -14,6 +14,7 @@ limitations under the License. */ | |||
|
|||
#pragma once | |||
|
|||
#include <paddle/utils/Error.h> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
按照 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"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
缺少空行。下面有些地方也缺少了空行。
@@ -0,0 +1,28 @@ | |||
/* Copyright (c) 2016 PaddlePaddle Authors. All Rights Reserved. | |||
Licensed under the Apache License, Version 2.0 (the "License"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
缺少空行。
limitations under the License. */ | ||
|
||
#pragma once | ||
#include <memory> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#pragma 和 #include 之间缺少空行
#pragma once | ||
#include <memory> | ||
#include <string> | ||
namespace paddle { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include 和 namespace 之间缺少空行
#include <memory> | ||
#include <string> | ||
namespace paddle { | ||
typedef std::unique_ptr<std::exception> ErrorPtr; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
缺少空行
#include <string> | ||
namespace paddle { | ||
typedef std::unique_ptr<std::exception> ErrorPtr; | ||
class Error : public std::exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
缺少空行
#include <string> | ||
namespace paddle { | ||
typedef std::unique_ptr<std::exception> ErrorPtr; | ||
class Error : public std::exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
按照C++ style guide的要求,我们不应该使用exceptions,为什么要定义这个exception type?
@@ -143,7 +144,19 @@ void runInitFunctions() { | |||
}); | |||
} | |||
|
|||
static void logAllUnhandledExceptions() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
如果按照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.