-
Notifications
You must be signed in to change notification settings - Fork 126
Expand file tree
/
Copy pathRegistryException.php
More file actions
35 lines (29 loc) · 985 Bytes
/
RegistryException.php
File metadata and controls
35 lines (29 loc) · 985 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
/*
* This file is part of the official PHP MCP SDK.
*
* A collaboration between Symfony and the PHP Foundation.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Mcp\Exception;
use Mcp\Schema\JsonRpc\Error;
final class RegistryException extends \Exception implements ExceptionInterface
{
public static function invalidParams(string $message = 'Invalid params', ?\Throwable $previous = null): self
{
return new self($message, Error::INVALID_PARAMS, $previous);
}
public static function internalError(?string $details = null, ?\Throwable $previous = null): self
{
$message = 'Internal error';
if (null !== $details) {
$message .= ': '.$details;
}
if (null !== $previous) {
$message .= ' (See server logs)';
}
return new self($message, Error::INTERNAL_ERROR, $previous);
}
}