Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Improve UX by providing more information #802

Merged
merged 2 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion api/http/handlerfuncs.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ func rootHandler(rw http.ResponseWriter, req *http.Request) {
req.Context(),
rw,
simpleDataResponse(
"response", "Welcome to the DefraDB HTTP API. Use /graphql to send queries to the database",
"response", "Welcome to the DefraDB HTTP API. Use /graphql to send queries to the database."+
" Read the documentation at https://docs.source.network/.",
),
http.StatusOK,
)
Expand Down
2 changes: 1 addition & 1 deletion api/http/handlerfuncs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func TestRootHandler(t *testing.T) {
})
switch v := resp.Data.(type) {
case map[string]any:
assert.Equal(t, "Welcome to the DefraDB HTTP API. Use /graphql to send queries to the database", v["response"])
assert.Equal(t, "Welcome to the DefraDB HTTP API. Use /graphql to send queries to the database. Read the documentation at https://docs.source.network/.", v["response"])
default:
t.Fatalf("data should be of type map[string]any but got %T", resp.Data)
}
Expand Down
4 changes: 2 additions & 2 deletions api/http/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ func loggerMiddleware(next http.Handler) http.Handler {
lrw.statusCode,
),
logging.NewKV(
"Length",
"LengthBytes",
lrw.contentLength,
),
logging.NewKV(
"Elapsed",
"ElapsedSeconds",
elapsed,
),
)
Expand Down
2 changes: 1 addition & 1 deletion api/http/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func TestLoggerKeyValueOutput(t *testing.T) {
assert.Equal(t, "GET", kv["Method"])
assert.Equal(t, "/ping", kv["Path"])
assert.Equal(t, float64(200), kv["Status"])
assert.Equal(t, float64(28), kv["Length"])
assert.Equal(t, float64(28), kv["LengthBytes"])
}

func readLog(path string) (map[string]any, error) {
Expand Down
2 changes: 1 addition & 1 deletion db/collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
)

var (
ErrDocumentAlreadyExists = errors.New("A document with the given key already exists")
ErrDocumentAlreadyExists = errors.New("A document with the given dockey already exists")
ErrUnknownCRDTArgument = errors.New("Invalid CRDT arguments")
ErrUnknownCRDT = errors.New("")
)
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/mutation/simple/create/simple_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestMutationCreateSimpleDoesNotCreateDocGivenDuplicate(t *testing.T) {
}`,
},
},
ExpectedError: "A document with the given key already exists",
ExpectedError: "A document with the given dockey already exists",
}

simpleTests.ExecuteTestCase(t, test)
Expand Down