Feed error messages through a cors wrapper so that people on other domains can see what's happening.

This commit is contained in:
jakedt 2014-03-17 16:57:35 -04:00
parent 4673f40dd2
commit 3b3d71bfd7
18 changed files with 162 additions and 129 deletions

View file

@ -1,10 +1,9 @@
import logging
import stripe
from endpoints.api import request_error, log_action
from endpoints.api import request_error, log_action, NotFound
from data import model
from data.plans import PLANS
from util.http import abort
logger = logging.getLogger(__name__)
@ -31,13 +30,13 @@ def subscribe(user, plan, token, require_business_plan):
if not plan_found or plan_found['deprecated']:
logger.warning('Plan not found or deprecated: %s', plan)
abort(404)
raise NotFound()
if (require_business_plan and not plan_found['bus_features'] and not
plan_found['price'] == 0):
logger.warning('Business attempting to subscribe to personal plan: %s',
user.username)
return request_error(message='No matching plan found')
raise request_error(message='No matching plan found')
private_repos = model.get_private_repo_count(user.username)