Change capitalisation of PError.{code,message}
This commit is contained in:
parent
280703edd8
commit
c1cac50095
18
main.go
18
main.go
|
@ -147,8 +147,8 @@ func populatePErrors() error {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
perrors[url.String()] = PError{
|
perrors[url.String()] = PError{
|
||||||
code: gemini.Status(code),
|
Code: gemini.Status(code),
|
||||||
message: unescaper.Replace(values[2]),
|
Message: unescaper.Replace(values[2]),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -175,7 +175,7 @@ func savePErrors() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
_, err = writer.WriteString(strconv.Itoa(int(perror.code)))
|
_, err = writer.WriteString(strconv.Itoa(int(perror.Code)))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -183,7 +183,7 @@ func savePErrors() error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
_, err = escaper.WriteString(writer, perror.message)
|
_, err = escaper.WriteString(writer, perror.Message)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
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)
|
return do(client, ctx, &redirect, via)
|
||||||
}
|
}
|
||||||
if perror, exists := perrors[req.URL.String()]; exists {
|
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)
|
resp, err := client.Do(ctx, req)
|
||||||
if err != nil {
|
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 {
|
if resp.Status.Class() == gemini.StatusPermanentFailure {
|
||||||
perrors[req.URL.String()] = PError{
|
perrors[req.URL.String()] = PError{
|
||||||
code: resp.Status,
|
Code: resp.Status,
|
||||||
message: resp.Meta,
|
Message: resp.Meta,
|
||||||
}
|
}
|
||||||
err = savePErrors()
|
err = savePErrors()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -399,8 +399,8 @@ func (a ByTime) Swap(i, j int) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type PError struct {
|
type PError struct {
|
||||||
code gemini.Status
|
Code gemini.Status
|
||||||
message string
|
Message string
|
||||||
}
|
}
|
||||||
|
|
||||||
type AtomWriter struct {
|
type AtomWriter struct {
|
||||||
|
|
Loading…
Reference in New Issue