in lambda/api/app.py [0:0]
def get_error():
# Illustrates capturing an error and re-raising with something sensible for the end client
try:
raise Exception("Demo error")
except Exception as e:
logger.error(e)
metrics.add_metric(name='API_Error_Simulated',
unit=MetricUnit.Count, value=1)
raise ServiceError(502, "Something went wrong! Please try again.")