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