rocketmq_common/common/
faq.rs1pub struct FAQUrl;
19
20impl FAQUrl {
21 pub const APPLY_TOPIC_URL: &'static str = "https://rocketmq.apache.org/docs/bestPractice/06FAQ";
22 pub const CLIENT_PARAMETER_CHECK_URL: &'static str =
23 "https://rocketmq.apache.org/docs/bestPractice/06FAQ";
24 pub const CLIENT_SERVICE_NOT_OK: &'static str =
25 "https://rocketmq.apache.org/docs/bestPractice/06FAQ";
26 pub const GROUP_NAME_DUPLICATE_URL: &'static str =
27 "https://rocketmq.apache.org/docs/bestPractice/06FAQ";
28 pub const LOAD_JSON_EXCEPTION: &'static str =
29 "https://rocketmq.apache.org/docs/bestPractice/06FAQ";
30 const MORE_INFORMATION: &'static str = "For more information, please visit the url, ";
31 pub const MQLIST_NOT_EXIST: &'static str =
32 "https://rocketmq.apache.org/docs/bestPractice/06FAQ";
33 pub const NAME_SERVER_ADDR_NOT_EXIST_URL: &'static str =
34 "https://rocketmq.apache.org/docs/bestPractice/06FAQ";
35 pub const NO_TOPIC_ROUTE_INFO: &'static str =
37 "https://rocketmq.apache.org/docs/bestPractice/06FAQ";
38 pub const SAME_GROUP_DIFFERENT_TOPIC: &'static str =
39 "https://rocketmq.apache.org/docs/bestPractice/06FAQ";
40 pub const SEND_MSG_FAILED: &'static str = "https://rocketmq.apache.org/docs/bestPractice/06FAQ";
41 pub const SUBSCRIPTION_GROUP_NOT_EXIST: &'static str =
42 "https://rocketmq.apache.org/docs/bestPractice/06FAQ";
43 const TIP_STRING_BEGIN: &'static str = "\nSee ";
44 const TIP_STRING_END: &'static str = " for further details.";
45 pub const UNEXPECTED_EXCEPTION_URL: &'static str =
46 "https://rocketmq.apache.org/docs/bestPractice/06FAQ";
47 pub const UNKNOWN_HOST_EXCEPTION: &'static str =
48 "https://rocketmq.apache.org/docs/bestPractice/06FAQ";
49
50 pub fn suggest_todo(url: &'static str) -> String {
51 format!("{}{}{}", Self::TIP_STRING_BEGIN, url, Self::TIP_STRING_END)
52 }
53
54 pub fn attach_default_url(error_message: Option<&str>) -> String {
55 if let Some(err_msg) = error_message {
56 if !err_msg.contains(Self::TIP_STRING_BEGIN) {
57 return format!(
58 "{}\n{}{}",
59 err_msg,
60 Self::MORE_INFORMATION,
61 Self::UNEXPECTED_EXCEPTION_URL
62 );
63 }
64 }
65 error_message.unwrap_or_default().to_string()
66 }
67}