errorDocsURL checks if the error value implements [errctx.Error] and has a non-empty DocsURL. If so, it returns a slog.Attr containing the docs URL; otherwise, it returns nil.
()
| 123 | // errorDocsURL checks if the error value implements [errctx.Error] and has a non-empty DocsURL. |
| 124 | // If so, it returns a slog.Attr containing the docs URL; otherwise, it returns nil. |
| 125 | func (s *formatterCommon) errorDocsURL() *slog.Attr { |
| 126 | if v, ok := s.error.Value.Any().(errctx.Error); ok { |
| 127 | if url := v.DocsURL(); url != "" { |
| 128 | return &slog.Attr{Key: s.error.Key + "_docs_url", Value: slog.StringValue(url)} |
| 129 | } |
| 130 | } |
| 131 | |
| 132 | return nil |
| 133 | } |