File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44
55use Wikibase \DataModel \Entity \DispatchingEntityIdParser ;
66use Wikibase \DataModel \Entity \EntityIdParser ;
7+ use Wikibase \DataModel \Entity \EntityIdParsingException ;
78
89/**
910 * @since 0.5
@@ -41,7 +42,12 @@ public function parse( $serialization ) {
4142 throw new ClaimGuidParsingException ( '$serialization does not have the correct number of parts ' );
4243 }
4344
44- return new ClaimGuid ( $ this ->entityIdParser ->parse ( $ keyParts [0 ] ), $ keyParts [1 ] );
45+ try {
46+ return new ClaimGuid ( $ this ->entityIdParser ->parse ( $ keyParts [0 ] ), $ keyParts [1 ] );
47+ }
48+ catch ( EntityIdParsingException $ exception ) {
49+ throw new ClaimGuidParsingException ( '$serialization contains invalid EntityId: ' . $ exception ->getMessage () );
50+ }
4551 }
4652
47- }
53+ }
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ public function invalidIdSerializationProvider() {
5656 array ( '' ),
5757 array ( 'q0 ' ),
5858 array ( '1p ' ),
59+ array ( 'Q0$5627445f-43cb-ed6d-3adb-760e85bd17ee ' ),
5960 );
6061 }
6162
You can’t perform that action at this time.
0 commit comments