Skip to content

Commit 20b0285

Browse files
authored
Merge pull request #5834 from stsewd/raise-error-when-project-isnt-public
Raise CommandError when there isn't data from the api
2 parents b67fbf7 + 7b279ff commit 20b0285

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

readthedocs/projects/management/commands/import_project_from_live.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
# -*- coding: utf-8 -*-
2-
31
"""Import project command."""
42

53
import json
64
import os
75

6+
import requests
87
from django.contrib.auth.models import User
98
from django.core.management import call_command
10-
from django.core.management.base import BaseCommand
11-
import requests
9+
from django.core.management.base import BaseCommand, CommandError
1210

1311
from ...models import Project
1412

@@ -57,7 +55,7 @@ def handle(self, *args, **options):
5755
if response_data['count'] == 1:
5856
project_data = response_data['results'][0]
5957
else:
60-
self.stderr.write(
58+
raise CommandError(
6159
'Cannot find {slug} in API. Response was:\n{response}'.format(
6260
slug=slug,
6361
response=json.dumps(response_data),

0 commit comments

Comments
 (0)