Merge pull request #984 from zeroclaw-labs/fix/improve-config-error-messages
fix(errors): improve config error messages with section paths and remediation hints
This commit is contained in:
commit
007e9fa7ea
4 changed files with 15 additions and 6 deletions
|
|
@ -125,7 +125,8 @@ impl LinqChannel {
|
|||
if !self.is_sender_allowed(&normalized_from) {
|
||||
tracing::warn!(
|
||||
"Linq: ignoring message from unauthorized sender: {normalized_from}. \
|
||||
Add to allowed_senders in config.toml."
|
||||
Add to channels.linq.allowed_senders in config.toml, \
|
||||
or run `zeroclaw onboard --channels-only` to configure interactively."
|
||||
);
|
||||
return messages;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -387,7 +387,7 @@ impl TelegramChannel {
|
|||
.await
|
||||
.with_context(|| format!("Failed to read config file: {}", config_path.display()))?;
|
||||
let mut config: Config = toml::from_str(&contents)
|
||||
.context("Failed to parse config file for Telegram binding")?;
|
||||
.context("Failed to parse config.toml — check [channels.telegram] section for syntax errors")?;
|
||||
config.config_path = config_path;
|
||||
config.workspace_dir = zeroclaw_dir.join("workspace");
|
||||
Ok(config)
|
||||
|
|
@ -396,7 +396,11 @@ impl TelegramChannel {
|
|||
async fn persist_allowed_identity(&self, identity: &str) -> anyhow::Result<()> {
|
||||
let mut config = Self::load_config_without_env().await?;
|
||||
let Some(telegram) = config.channels_config.telegram.as_mut() else {
|
||||
anyhow::bail!("Telegram channel config is missing in config.toml");
|
||||
anyhow::bail!(
|
||||
"Missing [channels.telegram] section in config.toml. \
|
||||
Add bot_token and allowed_users under [channels.telegram], \
|
||||
or run `zeroclaw onboard --channels-only` to configure interactively"
|
||||
);
|
||||
};
|
||||
|
||||
let normalized = Self::normalize_identity(identity);
|
||||
|
|
@ -691,7 +695,7 @@ impl TelegramChannel {
|
|||
} else {
|
||||
let _ = self
|
||||
.send(&SendMessage::new(
|
||||
"ℹ️ Telegram pairing is not active. Ask operator to update allowlist in config.toml.",
|
||||
"ℹ️ Telegram pairing is not active. Ask operator to add your user ID to channels.telegram.allowed_users in config.toml.",
|
||||
&chat_id,
|
||||
))
|
||||
.await;
|
||||
|
|
|
|||
|
|
@ -99,7 +99,8 @@ impl WhatsAppChannel {
|
|||
if !self.is_number_allowed(&normalized_from) {
|
||||
tracing::warn!(
|
||||
"WhatsApp: ignoring message from unauthorized number: {normalized_from}. \
|
||||
Add to allowed_numbers in config.toml, then run `zeroclaw onboard --channels-only`."
|
||||
Add to channels.whatsapp.allowed_numbers in config.toml, \
|
||||
or run `zeroclaw onboard --channels-only` to configure interactively."
|
||||
);
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -219,7 +219,10 @@ impl Tool for WebSearchTool {
|
|||
let result = match self.provider.as_str() {
|
||||
"duckduckgo" | "ddg" => self.search_duckduckgo(query).await?,
|
||||
"brave" => self.search_brave(query).await?,
|
||||
_ => anyhow::bail!("Unknown search provider: {}", self.provider),
|
||||
_ => anyhow::bail!(
|
||||
"Unknown search provider: '{}'. Set tools.web_search.provider to 'duckduckgo' or 'brave' in config.toml",
|
||||
self.provider
|
||||
),
|
||||
};
|
||||
|
||||
Ok(ToolResult {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue