Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Display error message for NetworkErrorCode #1678

Merged
merged 1 commit into from
Jan 31, 2017
Merged

Conversation

congwang
Copy link
Contributor

This is to resolve #1654.

@@ -30,4 +33,12 @@ enum NetworkErrorCode {
TIMEOUT
};

static inline std::ostream& operator<<(std::ostream& os, const NetworkErrorCode code) {
std::string strs[] = { "OK", "Connection error", "Read error", "Write error",
Copy link
Contributor

Choose a reason for hiding this comment

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

Can these instead be bound directly to the enum values themselves, instead of managed separately?
http://en.cppreference.com/w/cpp/language/enum

Copy link
Contributor Author

@congwang congwang Jan 25, 2017

Choose a reason for hiding this comment

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

I am not aware of any C++ syntax for this, we may achieve it by a wrapper class or something like that, but I doubt it is worth the effort to improve it. Does it hurt readability to you?

Copy link
Contributor

Choose a reason for hiding this comment

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

this looks useful https://aantron.github.io/better-enums/tutorial/Conversions.html#Strings and easy to include in, if we bother to use it at all...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is always some way to do it. Again, why do you think it is worth our effort to do it? For me, we only have one case so far, no need to bother a complex way to make it unnecessarily elegant. If you believe it is worth, you are welcome to do it in a separate PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

just pointing out. i have no opinion since C++ language does not have the capability of allowing people to use enum reflection easily.

@objmagic
Copy link
Contributor

can you check out the CI?

@congwang
Copy link
Contributor Author

@objmagic IntegrationTest_MultiSpoutsMultiTasks fails.

@congwang
Copy link
Contributor Author

There is a new CI failure:

[ RUN      ] StMgr.test_tmaster_restart_on_new_address
src/central_freelist.cc:333] tcmalloc: allocation failed 24576 
Unknown exception caught in global handler

@objmagic
Copy link
Contributor

Thanks. I'll just restart the CI.

@objmagic
Copy link
Contributor

The PR CI is fine. Feel free to merge it.

@objmagic objmagic merged commit efdcb60 into master Jan 31, 2017
@objmagic
Copy link
Contributor

The PR CI check passed. Merged.

@congwang congwang deleted the cwang/error-code branch February 7, 2017 21:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve log message for connection errors
3 participants