-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[1.x] Improve redis exception (#168)
* improve redis exception * Fix code styling --------- Co-authored-by: timacdonald <[email protected]>
- Loading branch information
1 parent
2c97b11
commit 3936f1a
Showing
4 changed files
with
35 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace Laravel\Pulse\Support; | ||
|
||
use RuntimeException; | ||
use Throwable; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
class RedisServerException extends RuntimeException | ||
{ | ||
/** | ||
* Create an exception from the client's error message. | ||
*/ | ||
public static function whileRunningCommand(string $command, string $message, ?Throwable $previous = null): self | ||
{ | ||
if (str_starts_with($message, 'ERR syntax error')) { | ||
$message = "The Redis version does not support the command or some of its arguments [{$command}]. Redis error: [{$message}]."; | ||
} else { | ||
$message = "Error running command [{$command}]. Redis error: [{$message}]."; | ||
} | ||
|
||
return new self($message, previous: $previous); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters