Skip to content

Commit

Permalink
fix unhandled errors and update code comments to help the IDEs (#2128)
Browse files Browse the repository at this point in the history
* fix unhandled errors

* fix unhandled error in cache package test

* omit variable type

* omit variable type

* rename variable because collide with the imported package name

* handle file error on closing

* fix unhandled in common_linux.go

* fix unhandled errors in helpers_test.go

* fix unhandled errors in listen_test.go

* remove unused parameter in emptyHandler method

* refactor path.go

* unhandled error in hooks test

* fix unhandled errors in app_test.go

* fix unhandled errors in ctx_test.go

* ✨ fix unhandled errors in helpers_test.go

* revert app_test.go

* remove redundant parentheses and update comments

* update code comment for helping ide

* update code comment for helping ide

* fix unhandled error in app_test.go

* update code comments for helping IDEs

* fix unhandled errors in app_test.go

* update code comment for helping the IDEs
  • Loading branch information
Kamandlou committed Sep 28, 2022
1 parent 4108d73 commit 66d5b19
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions app_test.go
Expand Up @@ -1343,7 +1343,10 @@ func Test_App_ReadTimeout(t *testing.T) {

conn, err := net.Dial(NetworkTCP4, "127.0.0.1:4004")
utils.AssertEqual(t, nil, err)
defer conn.Close()
defer func(conn net.Conn) {
err := conn.Close()
utils.AssertEqual(t, nil, err)
}(conn)

_, err = conn.Write([]byte("HEAD /read-timeout HTTP/1.1\r\n"))
utils.AssertEqual(t, nil, err)
Expand Down Expand Up @@ -1375,7 +1378,10 @@ func Test_App_BadRequest(t *testing.T) {
time.Sleep(500 * time.Millisecond)
conn, err := net.Dial(NetworkTCP4, "127.0.0.1:4005")
utils.AssertEqual(t, nil, err)
defer conn.Close()
defer func(conn net.Conn) {
err := conn.Close()
utils.AssertEqual(t, nil, err)
}(conn)

_, err = conn.Write([]byte("BadRequest\r\n"))
utils.AssertEqual(t, nil, err)
Expand Down
2 changes: 1 addition & 1 deletion error.go
Expand Up @@ -7,7 +7,7 @@ import (
)

type (
// Conversion error exposes the internal schema.ConversionError for public use.
// ConversionError Conversion error exposes the internal schema.ConversionError for public use.
ConversionError = schema.ConversionError
// UnknownKeyError error exposes the internal schema.UnknownKeyError for public use.
UnknownKeyError = schema.UnknownKeyError
Expand Down

0 comments on commit 66d5b19

Please sign in to comment.