Skip to content

Commit

Permalink
ComponentCarrierError
Browse files Browse the repository at this point in the history
  • Loading branch information
Archmonger committed Sep 15, 2023
1 parent 7177cfe commit b394e0a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/reactpy_django/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ class ComponentDoesNotExistError(AttributeError):

class InvalidHostError(ValueError):
...


class ComponentCarrierError(ValueError):
...
5 changes: 3 additions & 2 deletions src/reactpy_django/templatetags/reactpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

from reactpy_django import config, models
from reactpy_django.exceptions import (
ComponentCarrierError,
ComponentDoesNotExistError,
ComponentParamError,
InvalidHostError,
Expand Down Expand Up @@ -121,10 +122,10 @@ def component(
if not request:
msg = (
"Cannot preload component without a HTTP request. Are you missing the "
"request context processor in settings.py:TEMPLATES['OPTIONS']['context_processors']?"
)
"request context processor in settings.py:TEMPLATES['OPTIONS']['context_processors']?"
_logger.error(msg)
return failure_context(dotted_path, ComponentDoesNotExistError(msg))
return failure_context(dotted_path, ComponentCarrierError(msg))
_preload_html = preload_component(user_component, args, kwargs, request)

# Return the template rendering context
Expand Down

0 comments on commit b394e0a

Please sign in to comment.