Not, not Non for the exception.
This commit is contained in:
parent
dd85f35f5a
commit
9e73d10e59
@ -2,11 +2,11 @@ from __future__ import unicode_literals
|
|||||||
from moto.core.exceptions import RESTError
|
from moto.core.exceptions import RESTError
|
||||||
|
|
||||||
|
|
||||||
class StageNonFoundException(RESTError):
|
class StageNotFoundException(RESTError):
|
||||||
code = 404
|
code = 404
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(StageNonFoundException, self).__init__(
|
super(StageNotFoundException, self).__init__(
|
||||||
"NonFoundException", "Invalid stage identifier specified")
|
"NotFoundException", "Invalid stage identifier specified")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ import requests
|
|||||||
from moto.core import BaseBackend
|
from moto.core import BaseBackend
|
||||||
from moto.core.utils import iso_8601_datetime_with_milliseconds
|
from moto.core.utils import iso_8601_datetime_with_milliseconds
|
||||||
from .utils import create_id
|
from .utils import create_id
|
||||||
from .exceptions import StageNonFoundException
|
from .exceptions import StageNotFoundException
|
||||||
|
|
||||||
STAGE_URL = "https://{api_id}.execute-api.{region_name}.amazonaws.com/{stage_name}"
|
STAGE_URL = "https://{api_id}.execute-api.{region_name}.amazonaws.com/{stage_name}"
|
||||||
|
|
||||||
@ -427,7 +427,7 @@ class APIGatewayBackend(BaseBackend):
|
|||||||
api = self.get_rest_api(function_id)
|
api = self.get_rest_api(function_id)
|
||||||
stage = api.stages.get(stage_name)
|
stage = api.stages.get(stage_name)
|
||||||
if stage is None:
|
if stage is None:
|
||||||
raise StageNonFoundException()
|
raise StageNotFoundException()
|
||||||
else:
|
else:
|
||||||
return stage
|
return stage
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import json
|
|||||||
|
|
||||||
from moto.core.responses import BaseResponse
|
from moto.core.responses import BaseResponse
|
||||||
from .models import apigateway_backends
|
from .models import apigateway_backends
|
||||||
from .exceptions import StageNonFoundException
|
from .exceptions import StageNotFoundException
|
||||||
|
|
||||||
|
|
||||||
class APIGatewayResponse(BaseResponse):
|
class APIGatewayResponse(BaseResponse):
|
||||||
@ -136,7 +136,7 @@ class APIGatewayResponse(BaseResponse):
|
|||||||
if self.method == 'GET':
|
if self.method == 'GET':
|
||||||
try:
|
try:
|
||||||
stage_response = self.backend.get_stage(function_id, stage_name)
|
stage_response = self.backend.get_stage(function_id, stage_name)
|
||||||
except StageNonFoundException as error:
|
except StageNotFoundException as error:
|
||||||
return error.code, headers,'{{"message":"{0}","code":"{1}"}}'.format(error.message,error.error_type)
|
return error.code, headers,'{{"message":"{0}","code":"{1}"}}'.format(error.message,error.error_type)
|
||||||
elif self.method == 'PATCH':
|
elif self.method == 'PATCH':
|
||||||
patch_operations = self._get_param('patchOperations')
|
patch_operations = self._get_param('patchOperations')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user