brandur / json_schema

A JSON Schema V4 and Hyperschema V4 parser and validator.
MIT License
230 stars 45 forks source link

Enable SchemaError to #to_s even if schema pointer not present #74

Closed brandur closed 7 years ago

brandur commented 7 years ago

It seems that I run into quite a few errors while debugging that actually occur because Ruby is trying to show me a SchemaError but can't because its #to_s can't run because no pointer is present.

This patch still shows the same information in #to_s, but makes the method a little more robust in that it can still run even if a schema wasn't present. This probably still represents a problem case, but if we want to throw an error, doing so from inside an error class isn't the place to do it.