Skip to content
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

Closed

Conversation

reyoung
Copy link
Collaborator

@reyoung reyoung commented Jan 4, 2017

No description provided.

@@ -38,7 +38,8 @@ struct TrainerConfigHelperPrivate {
TrainerConfig conf;
};

TrainerConfigHelper::TrainerConfigHelper(const std::string &configFilePath)
TrainerConfigHelper::TrainerConfigHelper(
const std::string &configFilePath) throw(ErrorPtr &)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

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>
Copy link
Collaborator

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");
Copy link
Collaborator

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");
Copy link
Collaborator

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>
Copy link
Collaborator

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 {
Copy link
Collaborator

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;
Copy link
Collaborator

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 {
Copy link
Collaborator

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 {
Copy link
Collaborator

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() {
Copy link
Collaborator

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了.

@reyoung
Copy link
Collaborator Author

reyoung commented Jan 12, 2017

Closed due to I will give a better way handle errors.

@reyoung reyoung closed this Jan 12, 2017
@reyoung reyoung deleted the feature/disable_log_fatal branch January 12, 2017 04:44
zhhsplendid pushed a commit to zhhsplendid/Paddle that referenced this pull request Sep 25, 2019
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants