• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

localstack / localstack / a53c0273-9548-479e-ab3c-f3af40c0e980

13 May 2025 05:31PM UTC coverage: 86.624% (-0.03%) from 86.658%
a53c0273-9548-479e-ab3c-f3af40c0e980

push

circleci

web-flow
ASF: Mark optional params as such (X | None) (#12614)

5 of 7 new or added lines in 2 files covered. (71.43%)

34 existing lines in 16 files now uncovered.

64347 of 74283 relevant lines covered (86.62%)

0.87 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.0
/localstack-core/localstack/aws/handlers/fallback.py
1
"""Handlers for fallback logic, e.g., populating empty requests or defaulting with default exceptions."""
2

3
import logging
1✔
4

5
from rolo.gateway.handlers import EmptyResponseHandler
1✔
6
from werkzeug.exceptions import HTTPException
1✔
7

8
from localstack.http import Response
1✔
9

10
from ..api import RequestContext
1✔
11
from ..chain import ExceptionHandler, HandlerChain
1✔
12

13
__all__ = ["EmptyResponseHandler", "InternalFailureHandler"]
1✔
14

15
LOG = logging.getLogger(__name__)
1✔
16

17

18
class InternalFailureHandler(ExceptionHandler):
1✔
19
    """
20
    Exception handler that returns a generic error message if there was an exception and there is no response set yet.
21
    """
22

23
    def __call__(
1✔
24
        self,
25
        chain: HandlerChain,
26
        exception: Exception,
27
        context: RequestContext,
28
        response: Response,
29
    ):
30
        if response.data:
1✔
31
            # response already set
32
            return
1✔
33

34
        if isinstance(exception, HTTPException):
1✔
35
            response.status_code = exception.code
1✔
36
            response.headers.update(exception.get_headers())
1✔
37
            response.set_json({"error": exception.name, "message": exception.description})
1✔
38
            return
1✔
39

UNCOV
40
        LOG.debug("setting internal failure response for %s", exception)
×
UNCOV
41
        response.status_code = 500
×
UNCOV
42
        response.set_json(
×
43
            {
44
                "error": "Unexpected exception",
45
                "message": str(exception),
46
                "type": str(exception.__class__.__name__),
47
            }
48
        )
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc