litestar-vite 0.2.3__py3-none-any.whl → 0.2.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of litestar-vite might be problematic. Click here for more details.

@@ -1,4 +1,5 @@
1
1
  from .config import InertiaConfig
2
+ from .exception_handler import create_inertia_exception_response, exception_to_http_response
2
3
  from .middleware import InertiaMiddleware
3
4
  from .plugin import InertiaPlugin
4
5
  from .request import InertiaDetails, InertiaHeaders, InertiaRequest
@@ -28,4 +29,6 @@ __all__ = (
28
29
  "InertiaRedirect",
29
30
  "generate_js_routes",
30
31
  "InertiaMiddleware",
32
+ "exception_to_http_response",
33
+ "create_inertia_exception_response",
31
34
  )
@@ -72,9 +72,9 @@ def create_inertia_exception_response(request: Request[UserT, AuthT, StateT], ex
72
72
  content.update({"extra": extras})
73
73
  try:
74
74
  flash(request, detail, category="error")
75
- except Exception as flash_exc:
76
- msg = f"Failed to set the `flash` session state. Reason: {flash_exc.__cause__!s}"
77
- request.logger.exception(msg)
75
+ except AttributeError:
76
+ msg = "Unable to set `flash` session state. A valid session was not found for this request."
77
+ request.logger.warning(msg)
78
78
  if extras and len(extras) >= 1:
79
79
  message = extras[0]
80
80
  default_field = f"root.{message.get('key')}" if message.get("key", None) is not None else "root" # type: ignore
@@ -48,9 +48,9 @@ def share(
48
48
  ) -> None:
49
49
  try:
50
50
  connection.session.setdefault("_shared", {}).update({key: value})
51
- except Exception as exc:
52
- msg = f"Failed to set the `share` session state. Reason: {exc.__cause__!s}"
53
- connection.logger.exception(msg)
51
+ except AttributeError:
52
+ msg = "Unable to set `share` session state. A valid session was not found for this request."
53
+ connection.logger.warning(msg)
54
54
 
55
55
 
56
56
  def error(
@@ -60,9 +60,9 @@ def error(
60
60
  ) -> None:
61
61
  try:
62
62
  connection.session.setdefault("_errors", {}).update({key: message})
63
- except Exception as exc:
64
- msg = f"Failed to set the `error` session state. Reason: {exc.__cause__!s}"
65
- connection.logger.exception(msg)
63
+ except AttributeError:
64
+ msg = "Unable to set `error` session state. A valid session was not found for this request."
65
+ connection.logger.warning(msg)
66
66
 
67
67
 
68
68
  def get_shared_props(request: ASGIConnection[Any, Any, Any, Any]) -> Dict[str, Any]: # noqa: UP006
@@ -87,9 +87,9 @@ def get_shared_props(request: ASGIConnection[Any, Any, Any, Any]) -> Dict[str, A
87
87
  props[session_prop] = request.session.get(session_prop)
88
88
  props["flash"] = flash
89
89
  props["errors"] = {error_bag: errors} if error_bag is not None else errors
90
- except Exception as exc:
91
- msg = f"Failed to set the `error` session state. Reason: {exc.__cause__}"
92
- request.logger.exception(msg)
90
+ except AttributeError:
91
+ msg = "Unable to generate all shared props. A valid session was not found for this request."
92
+ request.logger.warning(msg)
93
93
  props["csrf_token"] = value_or_default(ScopeState.from_scope(request.scope).csrf_token, "")
94
94
  return props
95
95
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: litestar-vite
3
- Version: 0.2.3
3
+ Version: 0.2.4
4
4
  Summary: Vite plugin for Litestar
5
5
  Project-URL: Changelog, https://cofin.github.io/litestar-vite/latest/changelog
6
6
  Project-URL: Discord, https://discord.gg/X3FJqy8d2j
@@ -7,14 +7,14 @@ litestar_vite/loader.py,sha256=USrzNDppXgXLvW5WCuIgKPuM6MlECNIssnkwb_p-E8s,8117
7
7
  litestar_vite/plugin.py,sha256=p4VPKYdWw5qIYZ1OwfdMRcwM_Q-vfoDEmIbu3IyF7oI,5166
8
8
  litestar_vite/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  litestar_vite/template_engine.py,sha256=ffC4KPtUUNkuC0tJ0bD1Bu7c8lE33vKP0US1fWUYnO8,3853
10
- litestar_vite/inertia/__init__.py,sha256=PMOon8tag-20riAkHH3U4VLk7NBwt9lHsOHHSKMQHJQ,695
10
+ litestar_vite/inertia/__init__.py,sha256=RLeCWGHsHyBPpUjSXRhYOQlTh9cG33Q115zGH89M6XE,863
11
11
  litestar_vite/inertia/_utils.py,sha256=ijO9Lgka7ZPIAHkby9szbTGoSg0nDShC2bqWT9cDxi0,1956
12
12
  litestar_vite/inertia/config.py,sha256=ziEO-xQ5SoE7niri39PMXYgieM94Yf0y4BCFyaMs6P0,1125
13
- litestar_vite/inertia/exception_handler.py,sha256=DZQGVt7nNZRB1QcGFe2CXZwTXgMvR-8ldYS-P5AqpCw,4746
13
+ litestar_vite/inertia/exception_handler.py,sha256=HrFa8in0wF9V5PuctG3flIrhhEPsWUuocEW56_hfFAc,4747
14
14
  litestar_vite/inertia/middleware.py,sha256=NEDcAoT7GMWA9hEGvANZ3MG5_p3MmZX57RF95T71les,1716
15
15
  litestar_vite/inertia/plugin.py,sha256=ebAG9XnDBahttuc7WIUgBd3o_Ys8MdPS273LPNs5H8A,2344
16
16
  litestar_vite/inertia/request.py,sha256=hk8m1pmDiMbWhVurRDHfDPD24nMHp56JzUKV6SBDeqA,3665
17
- litestar_vite/inertia/response.py,sha256=yQd10cMgsYj0QO0zpjvvZu42x8u1hdf9FYffHQK1tL8,15652
17
+ litestar_vite/inertia/response.py,sha256=xaMm1KQllLmtRqoS7onf_pvIiwKz9P_POx_l01xjL28,15693
18
18
  litestar_vite/inertia/routes.py,sha256=QksJm2RUfL-WbuhOieYnPXXWO5GYnPtmsYEm6Ef8Yeo,1782
19
19
  litestar_vite/inertia/types.py,sha256=tLp0pm1N__hcWC875khf6wH1nuFlKS9-VjDqgsRkXnw,702
20
20
  litestar_vite/templates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -24,7 +24,7 @@ litestar_vite/templates/package.json.j2,sha256=0JWgdTuaSZ25EmCltF_zbqDdpxfvCLeYu
24
24
  litestar_vite/templates/styles.css.j2,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
25
  litestar_vite/templates/tsconfig.json.j2,sha256=q1REIuVyXUHCy4Zi2kgTkmrhdT98vyY89k-WTrImOj8,843
26
26
  litestar_vite/templates/vite.config.ts.j2,sha256=FZ4OJaB8Kjby_nlx4_LCP8eCe1LRi8kW2GspCiVMfDY,1115
27
- litestar_vite-0.2.3.dist-info/METADATA,sha256=NtL87u2sEObXDgcqZdHr2q8jTNkISPw30mEnGwIwjxE,6180
28
- litestar_vite-0.2.3.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
29
- litestar_vite-0.2.3.dist-info/licenses/LICENSE,sha256=HeTiEfEgvroUXZe_xAmYHxtTBgw--mbXyZLsWDYabHc,1069
30
- litestar_vite-0.2.3.dist-info/RECORD,,
27
+ litestar_vite-0.2.4.dist-info/METADATA,sha256=mYw52i0mueXhTjlZChQpedxUeQdeAnyZtvlvwFIa-8M,6180
28
+ litestar_vite-0.2.4.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87
29
+ litestar_vite-0.2.4.dist-info/licenses/LICENSE,sha256=HeTiEfEgvroUXZe_xAmYHxtTBgw--mbXyZLsWDYabHc,1069
30
+ litestar_vite-0.2.4.dist-info/RECORD,,