+ Start a Discussion
Lightning UserLightning User 

error handling

Hi,

   Is there a way to not render a component if there is something in the apex:messages? Thanks.

_Prasu__Prasu_

You can use dic parameter and hide the compoenets on the exception or error and rerender the page.

 

What are you trying do?

 

 

Lightning UserLightning User

Well I got the error printed in <apex:messages> but I only want to show what's in <apex:messages> if there is something in there. I'm trying to hide a <apex:pageBlock> if there is something in <apex:messages>

 

If it helps to give me a solution the error is the result of a query on page load that has no records.

_Prasu__Prasu_

Did you tried adding the return statement once exception occurs?

Lightning UserLightning User

The error happens in the constructor so I can't return anything

Lightning UserLightning User

I've figured it out, thanks for trying to help.