Catch "No applicable renderers found!" error? (Angular)

Hello. Is it possible to catch the error that causes the “No applicable renderers found!” message to be displayed on the screen? e.g. to warn the user with our own error handling? If so, any Angular examples would be great. Thanks.

[original thread by eebsie]

Hi @eebsie, can you elaborate more on your use case? I would be interested why you would like to handle this error differently.

We handle this error case by falling back to an “UnknownRenderer” when no applicable renderer is found for the current ui schema element, see the jsonforms.component. You could therefore register a custom renderer which is always applicable with the lowest possible priority. Then your renderer will be called instead of the UnknownRenderer and you can handle the error case yourself.

[eebsie]

Hi @sdirix. Thanks for that suggestion. I shall look into that. But the use case we have is that we will be getting the form schemas from another system via a REST service. As it could be possible for those schemas to contain something that can’t be rendered we were thinking of displaying our own error message (e.g. Angular material snackbar) to warn them of the problem. Do you think your suggestion will allow such a use case to be handled?

This approach should also cover your use case :wink:

I did something simular in Vue by creating a new renderer with lowest priority that emits an event in a context. By listening on the event I could catch the error anywhere in my context and take appropriate action.

1 Like

I got to this thread looking for pointers on how to debug “No applicable renderers found” messages. I don’t want to write a new renderer, I just need to be able to identify what is wrong in my schema that is causing this error. Any tips for that?

Thanks,
Shane

Hi @ShanePresley,

What this error means is that JsonFormsDispatch was called with a specific schema and uischema and there was no renderer registered who indicated that they could take this over.

This usually happens if:

  • The UI Schema does not fit to the JSON Schema (e.g. scopes resolving to properties which don’t exist in the JSON Schema), or
  • When some JSON Schema construct is used which is not supported by our off-the-shelf renderer sets, e.g. arrays with an items array instead of a single object, or
  • When some custom construct is added to the JSON Schema and the respective custom renderer does not properly indicate that they can take this over, or
  • When some custom renderer was implemented who uses JsonFormsDispatch itself but hands over invalid props

To debug you can set a breakpoint in the tester which you expect to apply and check why it doesn’t.

1 Like

Thank you Stefan. In case it wasn’t painfully obvious, I am not much of a web programmer, I am more on the data side of things. My issue ended up being that I spent all my time writing a reusable “definition” but I never actually added the corresponding property to the top-level object but that didn’t stop me from trying to reference it in my uischema. A silly mistake! but your tips helped get me out of it.

Thanks again

1 Like