[VSCE-157] Add Error Link Formatting

This commit is contained in:
Colin Young
2025-10-02 20:36:18 -07:00
parent 1e4541b982
commit 0f2c69fbef
+6 -6
View File
@@ -83,7 +83,7 @@ pub enum CodexErr {
UsageLimitReached(UsageLimitReachedError), UsageLimitReached(UsageLimitReachedError),
#[error( #[error(
"To use Codex with your ChatGPT plan, upgrade to Plus: https://openai.com/chatgpt/pricing." "To use Codex with your ChatGPT plan, [upgrade to Plus](https://openai.com/chatgpt/pricing)."
)] )]
UsageNotIncluded, UsageNotIncluded,
@@ -189,7 +189,7 @@ impl std::fmt::Display for UsageLimitReachedError {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let message = match self.plan_type.as_ref() { let message = match self.plan_type.as_ref() {
Some(PlanType::Known(KnownPlan::Plus)) => format!( Some(PlanType::Known(KnownPlan::Plus)) => format!(
"You've hit your usage limit. Upgrade to Pro (https://openai.com/chatgpt/pricing){}", "You've hit your usage limit. [Upgrade to Pro](https://openai.com/chatgpt/pricing){}",
retry_suffix_after_or(self.resets_in_seconds) retry_suffix_after_or(self.resets_in_seconds)
), ),
Some(PlanType::Known(KnownPlan::Team)) | Some(PlanType::Known(KnownPlan::Business)) => { Some(PlanType::Known(KnownPlan::Team)) | Some(PlanType::Known(KnownPlan::Business)) => {
@@ -199,7 +199,7 @@ impl std::fmt::Display for UsageLimitReachedError {
) )
} }
Some(PlanType::Known(KnownPlan::Free)) => { Some(PlanType::Known(KnownPlan::Free)) => {
"You've hit your usage limit. Upgrade to Plus to continue using Codex (https://openai.com/chatgpt/pricing)." "You've hit your usage limit. [Upgrade to Plus](https://openai.com/chatgpt/pricing) to continue using Codex."
.to_string() .to_string()
} }
Some(PlanType::Known(KnownPlan::Pro)) Some(PlanType::Known(KnownPlan::Pro))
@@ -336,7 +336,7 @@ mod tests {
}; };
assert_eq!( assert_eq!(
err.to_string(), err.to_string(),
"You've hit your usage limit. Upgrade to Pro (https://openai.com/chatgpt/pricing) or try again later." "You've hit your usage limit. [Upgrade to Pro](https://openai.com/chatgpt/pricing) or try again later."
); );
} }
@@ -349,7 +349,7 @@ mod tests {
}; };
assert_eq!( assert_eq!(
err.to_string(), err.to_string(),
"You've hit your usage limit. Upgrade to Plus to continue using Codex (https://openai.com/chatgpt/pricing)." "You've hit your usage limit. [Upgrade to Plus](https://openai.com/chatgpt/pricing) to continue using Codex."
); );
} }
@@ -427,7 +427,7 @@ mod tests {
}; };
assert_eq!( assert_eq!(
err.to_string(), err.to_string(),
"You've hit your usage limit. Upgrade to Pro (https://openai.com/chatgpt/pricing) or try again in 3 hours 32 minutes." "You've hit your usage limit. [Upgrade to Pro](https://openai.com/chatgpt/pricing) or try again in 3 hours 32 minutes."
); );
} }