Is there a way I can put detailed information in the ExceptionInfo?

18 views
Skip to first unread message

Yang Yang

unread,
Jan 26, 2017, 12:43:52 AM1/26/17
to Plumbing and Graph: the Clojure utility belt
Hi all,
I am currently building a validator for validation raml file.  I use  for
 (s/pred valid-uri-parameters? "error message")

for now, currently it only report a string without any further detail 


but for generating a more readable error message I would like to add information like the key name and path to the key to the error message.


Is there a way I can attach such information in the pred? , which can generate a better error message.

Thanks.



Jason Wolfe

unread,
Jan 26, 2017, 1:31:23 AM1/26/17
to Plumbing and Graph: the Clojure utility belt
Thanks for asking on here.

You should get back a structured object (which includes the key path, with a ValidationError at the leaf), it may just be obscured by the default printer.  I think printing it with pr-str may show what's actually there. 


There's no way to add to this map, but I think it should have what you want in there, maybe just not in the form you want.  To that end, you might  look into these libraries which have some facilities for working with the errors produced by schema.


Best, 
Jason
Reply all
Reply to author
Forward
0 new messages