forgejo/models/forgefed/error.go
famfo 5f432e32c8 chore(federation): re-enable nilnil lint (#11253)
First round of patches to re-enable some lints from my side.

This PR also refactors the general key fetching code quite a bit due to the way it currently worked
with relying on some values being nil sometimes.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/11253
Reviewed-by: elle <0xllx0@noreply.codeberg.org>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: famfo <famfo@famfo.xyz>
Co-committed-by: famfo <famfo@famfo.xyz>
2026-04-13 22:05:29 +02:00

22 lines
504 B
Go

// Copyright 2026 The Forgejo Authors. All rights reserved.
// SPDX-License-Identifier: GPL-3.0-or-later
package forgefed
import (
"fmt"
)
type ErrFederationHostNotFound struct {
SearchKey string
SearchValue string
}
func (err ErrFederationHostNotFound) Error() string {
return fmt.Sprintf("ErrFederationHostNotFound: search key: %s, search value: %s", err.SearchKey, err.SearchValue)
}
func IsErrFederationHostNotFound(err error) bool {
_, ok := err.(ErrFederationHostNotFound)
return ok
}