main 5041353

favicon_errors.go RawHistoryFolder

1package port
2
3import "errors"
4
5// ErrFaviconMiss is returned when a favicon cannot be found or served from allowed sources.
6var ErrFaviconMiss = errors.New("favicon miss")
7
8// ErrFaviconBusy is returned to direct refresh callers when the shared
9// refresh admission budget is exhausted. It is deliberately distinct from
10// ErrFaviconMiss: overload is not a miss and must never read as success.
11var ErrFaviconBusy = errors.New("favicon refresh overloaded")
12
13// ErrFaviconShutdown is returned to refresh callers arriving after the
14// use case began closing. Like overload, it is distinct from a miss.
15var ErrFaviconShutdown = errors.New("favicon refresh shutting down")
16
17// FaviconFetchError classifies a failed fetch while preserving
18// ErrFaviconMiss matching for existing callers. StatusCode carries the
19// HTTP status for HTTP failures and is zero for validation, transport,
20// cancellation, or DNS failures, which must never be negatively cached.
21type FaviconFetchError struct {
22	StatusCode int
23}
24
25func (e *FaviconFetchError) Error() string {
26	if e == nil || e.StatusCode == 0 {
27		return "favicon fetch failed"
28	}
29	return "favicon fetch failed: unexpected HTTP status"
30}
31
32// Is preserves ErrFaviconMiss matching so callers that treat every fetch
33// failure as a miss keep working; use FetchStatusCode for classification.
34func (*FaviconFetchError) Is(target error) bool {
35	return target == ErrFaviconMiss
36}
37
38// FetchStatusCode returns the HTTP status carried by err, if any.
39func FetchStatusCode(err error) (int, bool) {
40	var fetchErr *FaviconFetchError
41	if errors.As(err, &fetchErr) && fetchErr != nil {
42		return fetchErr.StatusCode, true
43	}
44	return 0, false
45}
46
47// ErrFaviconInvalidInput is returned when favicon storage receives invalid input.
48var ErrFaviconInvalidInput = errors.New("invalid favicon input")

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close