Resolve AT Protocol DIDs, handles, and schemas with intelligent caching for Laravel
1<?php
2
3namespace SocialDept\AtpResolver\Exceptions;
4
5class DidResolutionException extends ResolverException
6{
7 /**
8 * Create a new exception for unsupported DID method.
9 *
10 * @param string $method
11 */
12 public static function unsupportedMethod(string $method): self
13 {
14 return new self("Unsupported DID method: {$method}");
15 }
16
17 /**
18 * Create a new exception for invalid DID format.
19 *
20 * @param string $did
21 */
22 public static function invalidFormat(string $did): self
23 {
24 return new self("Invalid DID format: {$did}");
25 }
26
27 /**
28 * Create a new exception for resolution failure.
29 *
30 * @param string $did
31 * @param string $reason
32 */
33 public static function resolutionFailed(string $did, string $reason = ''): self
34 {
35 $message = "Failed to resolve DID: {$did}";
36
37 if ($reason) {
38 $message .= " ({$reason})";
39 }
40
41 return new self($message);
42 }
43}