teachers_pet doesn't fail gracefully for nonexisting users.
This issue probably exists for some other commands too.
My current workaround for create_student_teams is this, which just catches the error and continues.
--- a/lib/teachers_pet/client_decorator.rb
+++ b/lib/teachers_pet/client_decorator.rb
@@ -52,8 +52,12 @@ module TeachersPet
puts " -> @#{username} is already on @#{organization}/#{team[:name]}"
else
# https://github.com/octokit/octokit.rb/pull/518
- self.add_team_membership(team[:id], username, accept: 'application/vnd.github.the-wasp-preview+json')
- puts " -> @#{username} has been added to @#{organization}/#{team[:name]}"
+ begin
+ self.add_team_membership(team[:id], username, accept: 'application/vnd.github.the-wasp-preview+json')
+ puts " -> @#{username} has been added to @#{organization}/#{team[:name]}"
+ rescue
+ puts " -> Error adding user to team. #{username} might not exist."
+ end
end
end
end
teachers_pet doesn't fail gracefully for nonexisting users. This issue probably exists for some other commands too.
My current workaround for create_student_teams is this, which just catches the error and continues.