You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix bug 'not being able to create db in existing fly group' and improve errors (#949)
Free tier user was not able to create a DB in an existing fly group
after AWS rollout. Logic after this PR:
- If location flag is NOT provided, and user has no groups, defaults to
`closestLocation`. `isValidLocation` check is made.
- If location flag is NOT provided, and user has groups, defaults to
`group.Primary`. `isValidLocation` check is NOT made.
- If location flag IS provided, and user has no groups, uses that
location. `isValidLocation` check is made.
- If location flag IS provided, and user HAS groups, uses that location,
but the group must also have that location. `isValidLocation` check is
NOT made.
Also improve the error messages a bit
return turso.Group{}, fmt.Errorf("group %s does not exist", groupFlag)
149
+
return turso.Group{}, fmt.Errorf("group %s does not exist. Please double-check the name. You can run 'turso group list' to get a list of your groups, or 'turso group create' to make a new one", groupFlag)
149
150
}
150
151
for_, group:=rangegroups {
151
152
ifgroup.Name==groupFlag {
152
153
returngroup, nil
153
154
}
154
155
}
155
-
return turso.Group{}, fmt.Errorf("group %s does not exist", groupFlag)
156
+
return turso.Group{}, fmt.Errorf("group %s does not exist. Please double-check the name. You can run 'turso group list' to get a list of your groups, or 'turso group create' to make a new one", groupFlag)
return"", fmt.Errorf("location '%s' is not valid for group '%s'. The group has the following locations: %v. You can use 'turso group locations add' to add a new location to the group", loc, group.Name, strings.Join(group.Locations, ", "))
198
+
}
199
+
200
+
returnloc, nil
182
201
}
183
202
if!isValidLocation(client, loc) {
184
203
return"", fmt.Errorf("location '%s' is not valid", loc)
0 commit comments