Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/http/src/Session/FormSession.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
private const string ORIGINAL_VALUES_KEY = '#original_values';

public function __construct(
private Session $session,
private(set) Session $session,
) {}

/**
Expand Down
6 changes: 6 additions & 0 deletions packages/router/src/Exceptions/HtmlExceptionRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -104,6 +105,10 @@ private function shouldRenderDevelopmentException(Throwable $throwable): bool
return false;
}

if ($throwable instanceof ValidationFailed) {
return false;
}

if (! $throwable instanceof HttpRequestFailed) {
return true;
}
Expand All @@ -128,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(
Expand Down