File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33namespace Wikibase \DataModel \Claim ;
44
55use Wikibase \DataModel \Entity \EntityIdParser ;
6+ use Wikibase \DataModel \Entity \EntityIdParsingException ;
67
78/**
89 * @since 0.5
@@ -40,7 +41,12 @@ public function parse( $serialization ) {
4041 throw new ClaimGuidParsingException ( '$serialization does not have the correct number of parts ' );
4142 }
4243
43- return new ClaimGuid ( $ this ->entityIdParser ->parse ( $ keyParts [0 ] ), $ keyParts [1 ] );
44+ try {
45+ return new ClaimGuid ( $ this ->entityIdParser ->parse ( $ keyParts [0 ] ), $ keyParts [1 ] );
46+ }
47+ catch ( EntityIdParsingException $ exception ) {
48+ throw new ClaimGuidParsingException ( '$serialization contains invalid EntityId: ' . $ exception ->getMessage () );
49+ }
4450 }
4551
4652}
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