Parse and validate AT Protocol Lexicons with DTO generation for Laravel
1<?php
2
3namespace SocialDept\AtpSchema\Exceptions;
4
5class TypeResolutionException extends SchemaException
6{
7 /**
8 * Create exception for unknown type.
9 */
10 public static function unknownType(string $type): self
11 {
12 return static::withContext(
13 "Unknown Lexicon type: {$type}",
14 ['type' => $type]
15 );
16 }
17
18 /**
19 * Create exception for unresolvable reference.
20 */
21 public static function unresolvableReference(string $ref, string $nsid): self
22 {
23 return static::withContext(
24 "Cannot resolve reference {$ref} in schema {$nsid}",
25 ['ref' => $ref, 'nsid' => $nsid]
26 );
27 }
28
29 /**
30 * Create exception for circular reference.
31 */
32 public static function circularReference(string $ref, array $chain): self
33 {
34 return static::withContext(
35 "Circular reference detected: {$ref}",
36 ['ref' => $ref, 'chain' => $chain]
37 );
38 }
39}