Change capitalisation of PError.{code,message}

This commit is contained in:
blank X 2021-08-10 16:17:44 +07:00
parent 280703edd8
commit c1cac50095
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
1 changed files with 9 additions and 9 deletions

18
main.go
View File

@ -147,8 +147,8 @@ func populatePErrors() error {
continue
}
perrors[url.String()] = PError{
code: gemini.Status(code),
message: unescaper.Replace(values[2]),
Code: gemini.Status(code),
Message: unescaper.Replace(values[2]),
}
}
return nil
@ -175,7 +175,7 @@ func savePErrors() error {
if err != nil {
return err
}
_, err = writer.WriteString(strconv.Itoa(int(perror.code)))
_, err = writer.WriteString(strconv.Itoa(int(perror.Code)))
if err != nil {
return err
}
@ -183,7 +183,7 @@ func savePErrors() error {
if err != nil {
return err
}
_, err = escaper.WriteString(writer, perror.message)
_, err = escaper.WriteString(writer, perror.Message)
if err != nil {
return err
}
@ -223,7 +223,7 @@ func do(client gemini.Client, ctx context.Context, req *gemini.Request, via []*g
return do(client, ctx, &redirect, via)
}
if perror, exists := perrors[req.URL.String()]; exists {
return nil, req, errors.New(fmt.Sprintf("%d %s", perror.code, perror.message))
return nil, req, errors.New(fmt.Sprintf("%d %s", perror.Code, perror.Message))
}
resp, err := client.Do(ctx, req)
if err != nil {
@ -247,8 +247,8 @@ func do(client gemini.Client, ctx context.Context, req *gemini.Request, via []*g
}
if resp.Status.Class() == gemini.StatusPermanentFailure {
perrors[req.URL.String()] = PError{
code: resp.Status,
message: resp.Meta,
Code: resp.Status,
Message: resp.Meta,
}
err = savePErrors()
if err != nil {
@ -399,8 +399,8 @@ func (a ByTime) Swap(i, j int) {
}
type PError struct {
code gemini.Status
message string
Code gemini.Status
Message string
}
type AtomWriter struct {