fix(dingtalk): handle stream start error more accurately

Check for non-nil error before formatting error message to avoid wrapping nil errors.

generated by llmgit

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
chenhg5andClaude committed 2026-03-04 12:41:05 +08:00
1 parent e8e39413e8
commit 1e39199720
1 file changed
+5 -1
+5 -1
View File
@@ -66,9 +66,13 @@ func (p *Platform) Start(handler core.MessageHandler) error {
}()
// Give the stream a short window to fail fast on auth errors.
// If Start() returns nil quickly, it means it connected successfully (non-blocking SDK).
// If it doesn't return within 3s, it's a blocking call that's running fine.
select {
case err := <-errCh:
return fmt.Errorf("dingtalk: start stream: %w", err)
if err != nil {
return fmt.Errorf("dingtalk: start stream: %w", err)
}
case <-time.After(3 * time.Second):
}