Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mattermost/team.rb')
-rw-r--r--lib/mattermost/team.rb10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/mattermost/team.rb b/lib/mattermost/team.rb
index 5ee77aa9adf..2de01eced0b 100644
--- a/lib/mattermost/team.rb
+++ b/lib/mattermost/team.rb
@@ -1,7 +1,15 @@
module Mattermost
class Team
def self.all(session)
- session.get('/api/v3/teams/all').parsed_response
+ response = session.get('/api/v3/teams/all')
+
+ if response.success?
+ response.parsed_response
+ elsif response.parsed_response.try(:has_key?, 'message')
+ raise response.parsed_response['message']
+ else
+ raise 'Failed to list teams'
+ end
end
end
end