Skip to content

Commit

Permalink
Better error messaging for failed validation rule parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
shalvah committed Jul 28, 2021
1 parent a768c47 commit 0c4da38
Show file tree
Hide file tree
Showing 3 changed files with 383 additions and 330 deletions.
16 changes: 16 additions & 0 deletions src/Exceptions/CouldntProcessValidationRule.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Knuckles\Scribe\Exceptions;

use Throwable;

class CouldntProcessValidationRule extends \RuntimeException implements ScribeException
{
public static function forParam(string $paramName, $rule, Throwable $innerException): CouldntProcessValidationRule
{
return new self(
"Couldn't process this validation rule for the param `$paramName`: ".var_export($rule, true),
0, $innerException
);
}
}
15 changes: 15 additions & 0 deletions src/Exceptions/ProblemParsingValidationRules.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

namespace Knuckles\Scribe\Exceptions;

use Throwable;

class ProblemParsingValidationRules extends \RuntimeException implements ScribeException
{
public static function forParam(string $paramName, Throwable $innerException): ProblemParsingValidationRules
{
return new self(
"Problem processing validation rules for the param `$paramName`",
0, $innerException);
}
}
Loading

0 comments on commit 0c4da38

Please sign in to comment.