AndrewRedican / react-json-editor-ajrm

A modular, easy to use, react component, to view, edit, and debug javascript objects.
MIT License
355 stars 126 forks source link

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

Closed brunogenaro closed 1 year ago

brunogenaro commented 3 years ago
  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}
nneubarth commented 2 years ago

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}

AndrewRedican commented 1 year ago

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.