Skip to content

Commit 7934125

Browse files
authored
Merge pull request #105 from utopia-php/feat-improve-error-message
Improved 400 error messages
2 parents 0969d42 + 9bd15df commit 7934125

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/App.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,7 +739,7 @@ protected function validate(string $key, array $param, mixed $value): void
739739
}
740740

741741
if (!$validator->isValid($value)) {
742-
throw new Exception('Invalid ' . $key . ': ' . $validator->getDescription(), 400);
742+
throw new Exception('Invalid `' . $key . '` param: ' . $validator->getDescription(), 400);
743743
}
744744
}
745745

tests/AppTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public function testCanExecuteRoute(): void
185185
$result = \ob_get_contents();
186186
\ob_end_clean();
187187

188-
$this->assertEquals('error: Invalid x: Value must be a valid string and no longer than 1 chars', $result);
188+
$this->assertEquals('error: Invalid `x` param: Value must be a valid string and no longer than 1 chars', $result);
189189

190190
// With Hooks
191191

0 commit comments

Comments
 (0)