react-json-editor-ajrm icon indicating copy to clipboard operation
react-json-editor-ajrm copied to clipboard

Hide line number on custom error message if error.line is not provided

Open brunogenaro opened this issue 4 years ago • 1 comments

  1. What version of RJEA are you using (react-json-editor-ajrm version)? 2.5.13

  2. What operating system and processor architecture are you using? macOS Big Sur V11.5.1

  3. What did you do? * I'm doing an external JSON schema validation and providing the error.reason to the Component. Even though I don't send the error.line, is still showing as "at line null". So to be less weird, now I'm sending error.line as 0. (as you can see below) image

  4. What did you expect to see? If error.line is not provided (or provided as null, undefined, 0, false) I'd expect to see: {error.reason}

(Reference: https://github.com/AndrewRedican/react-json-editor-ajrm/blob/master/src/locale/en.js#L2)

  1. What did you see instead? * {reason} at line {line}

brunogenaro avatar Sep 14 '21 14:09 brunogenaro

I was able to get around this by modifying the locale when I have a custom error message that doesn't include line numbers:

locale={customError ? {...locale, format: "{reason}"} : locale}

nneubarth avatar Jan 04 '22 19:01 nneubarth

I no longer intend to update this project. I am working instead on a complete rewrite.

I'd like to thank you for using and taking interest in this project.

I also would like to apologize for not following up sooner. However, do realize for the most part this has been a one-man show, and the occasional contributions I used to receive. What I am saying is, I am in dire need of volunteers.

If this is something you would be interested in participating in, you can join in the discussion.

I've taken note of this thread, and I'll keep this under consideration for the new project.

AndrewRedican avatar Jan 29 '23 03:01 AndrewRedican