Skip to content

Commit

Permalink
Fix error message in Mark.from_json (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
cpmsmith authored Mar 10, 2022
1 parent ddbb327 commit d9108af
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions prosemirror/model/mark.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ def from_json(cls, schema, json_data):
json_data = json.loads(json_data)
if not json_data:
raise ValueError("Invalid input for Mark.fromJSON")
type = schema.marks.get(json_data["type"])
name = json_data["type"]
type = schema.marks.get(name)
if not type:
raise ValueError(f"There is not mark type {type} in this schema")
raise ValueError(f"There is no mark type {name} in this schema")
return type.create(json_data.get("attrs"))

@classmethod
Expand Down

0 comments on commit d9108af

Please sign in to comment.