Skip to content

Commit 7422048

Browse files
committed
update cli guest mode functionality
- add more user-friendly message on 402 response - version 1.19.2
1 parent b8c7412 commit 7422048

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

client/auth.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ func fetchWithAuth(method string, url string) ([]byte, error) {
8787
if err != nil {
8888
return nil, err
8989
}
90+
if code == 402 {
91+
return nil, fmt.Errorf("To run and submit the tests for this lesson, you must have an active Boot.dev membership\nhttps://boot.dev/pricing")
92+
}
9093
if code != 200 {
9194
return nil, fmt.Errorf("failed to %s to %s\nResponse: %d %s", method, url, code, string(body))
9295
}

client/lessons.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ const (
107107
)
108108

109109
func FetchLesson(uuid string) (*Lesson, error) {
110-
resp, err := fetchWithAuth("GET", "/v1/static/lessons/"+uuid)
110+
resp, err := fetchWithAuth("GET", "/v1/lessons/"+uuid)
111111
if err != nil {
112112
return nil, err
113113
}
@@ -162,6 +162,9 @@ func SubmitCLILesson(uuid string, results []CLIStepResult) (*StructuredErrCLI, e
162162
if err != nil {
163163
return nil, err
164164
}
165+
if code == 402 {
166+
return nil, fmt.Errorf("To run and submit the tests for this lesson, you must have an active Boot.dev membership\nhttps://boot.dev/pricing")
167+
}
165168
if code != 200 {
166169
return nil, fmt.Errorf("failed to submit CLI lesson (code: %v): %s", code, string(resp))
167170
}

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v1.19.1
1+
v1.19.2

0 commit comments

Comments
 (0)