From 98552d88b9ff936999dd9c5c2f3864ef7e3550c6 Mon Sep 17 00:00:00 2001 From: brendt Date: Tue, 13 Jan 2026 12:59:07 +0100 Subject: [PATCH 1/2] wip --- packages/router/src/Exceptions/HtmlExceptionRenderer.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/router/src/Exceptions/HtmlExceptionRenderer.php b/packages/router/src/Exceptions/HtmlExceptionRenderer.php index 01a2c570c..e2858da93 100644 --- a/packages/router/src/Exceptions/HtmlExceptionRenderer.php +++ b/packages/router/src/Exceptions/HtmlExceptionRenderer.php @@ -104,6 +104,10 @@ private function shouldRenderDevelopmentException(Throwable $throwable): bool return false; } + if ($throwable instanceof ValidationFailed) { + return false; + } + if (! $throwable instanceof HttpRequestFailed) { return true; } From ee0508cc4055fb4af0470579a17c51a9c74e700f Mon Sep 17 00:00:00 2001 From: brendt Date: Tue, 13 Jan 2026 13:13:00 +0100 Subject: [PATCH 2/2] wip --- packages/http/src/Session/FormSession.php | 2 +- packages/router/src/Exceptions/HtmlExceptionRenderer.php | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/http/src/Session/FormSession.php b/packages/http/src/Session/FormSession.php index 02ab623bb..e349a12cf 100644 --- a/packages/http/src/Session/FormSession.php +++ b/packages/http/src/Session/FormSession.php @@ -17,7 +17,7 @@ private const string ORIGINAL_VALUES_KEY = '#original_values'; public function __construct( - private Session $session, + private(set) Session $session, ) {} /** diff --git a/packages/router/src/Exceptions/HtmlExceptionRenderer.php b/packages/router/src/Exceptions/HtmlExceptionRenderer.php index e2858da93..e4bf13fbc 100644 --- a/packages/router/src/Exceptions/HtmlExceptionRenderer.php +++ b/packages/router/src/Exceptions/HtmlExceptionRenderer.php @@ -14,6 +14,7 @@ use Tempest\Http\SensitiveField; use Tempest\Http\Session\FormSession; use Tempest\Http\Session\Session; +use Tempest\Http\Session\SessionManager; use Tempest\Http\Status; use Tempest\Intl\Translator; use Tempest\Reflection\ClassReflector; @@ -132,6 +133,7 @@ private function renderValidationFailedResponse(ValidationFailed $exception): Re if ($this->container->has(Session::class)) { $this->container->get(FormSession::class)->setErrors($exception->failingRules); $this->container->get(FormSession::class)->setOriginalValues($this->filterSensitiveFields($this->request, $exception->targetClass)); + $this->container->get(SessionManager::class)->save($this->container->get(FormSession::class)->session); } $errors = Arr\map($exception->failingRules, fn (array $failingRulesForField, string $field) => Arr\map(