Removing default error (Request failed with an error)

Removing default error (Request failed with an error)

  

In my app, I have my action to check the network status and based on that I will display some message to the user. but by default, it is displaying "Request failed with an error"

The action is working good, but I need to disable the default message


Hi,

Look in Common > OnException (if you are not using the default check on project properties for global exception handler). Those error messages are created there. Make sure you really don't need them.

Best regards,

Marcelo

Hi,

I'm just curious about why are you receiving the error message at all?
If you don't have network and executes this client action, it will goes right in the IF (the False condition), will do an assign and will end the action.

What are you doing in the assign? Are you effectively going that way? There is anything else that you are doing after this client action that is causing an error?

Cheers,
Eduardo Jauch

Hi, I'm having the same exact problem. I'm checking the network status at the beggining of the OnIitialize event client action, but it seems that it's executing something before that and the "Request failed with an error" message appear instead of mine. The question is where to check the network status if it's not correct to do it in the OnInitialize event 

Hello Mariela,

I just made a test:

And when I open the screen, if the network is disconnected (no WiFi, no 4G/3G/H), I receive the message "Network Is Offiline".

Are you checking the network and still trying to do something that requires it?

Can you share a small module that we can use to reproduce the error?

Cheers,
Eduardo Jauch

Hi Eduardo.

This is the flow I have on my OnInitialize action:

Then, in the screen I have a register form, and this is the flow of the action called by the "save" button:


I'm checking the network status at the beginning of both, and if it's offline, the flow ends, so I don't think that it's executing anything else after that check.

Thanks for your soon answer.

Hi,

Do you have any aggregate in this screen that is getting data from server? Maybe to provide the source of the form?

Something is trying to reach the server. Can be something in the screen, not necessarily in the logic

Cheers

Eduardo Jauch

Yes, I'm retreiving data from a static Entity in the form, but I understand that the OnInitialize event executes before the form is rendered. Does it retreive the data erlier? In that case, where do you recommend to do the validation to know if the device is connected or not?

Hi Mariela,

Yes, the OnInitialize executes before. But you are just showing a message. The screen is still being executed.

The data will be retrieved asynchronously while the screen is rendered.

Here you have two options, at least.

1. Adopts an offline model, using local entities and synchronizing when required and network is available

2. Adopts redirecting to a screen to warn the user he is offline.

Cheers

Eduardo Jauch

Hi Eduardo, you're right. It's my first mobile app, and I'm not used to the asynchronous way mobile applications work. Redirecting to a new screen works fine for my use case. Thank you very much.

Mariela Mayorga wrote:

Hi, I'm having the same exact problem. I'm checking the network status at the beggining of the OnIitialize event client action, but it seems that it's executing something before that and the "Request failed with an error" message appear instead of mine. The question is where to check the network status if it's not correct to do it in the OnInitialize event 

Hi Mariela,


Also note that you may see different behaviour in the browser than you would in the OutSystems Now app (or the actual application). It appears in my browser (Chrome) when I am offline, GetNetworkStatus still returns True but a CommunicationException is triggered. However, in OutSystems Now, GetNetworkStatus works as expected.


Either way, make sure you test your app in OutSystems Now to make sure you are seeing the correct behaviour.


Regards,

Richard


Hi guys,

I'm having this same problem.

This action only work when the wi-fi is disabled or the mobile phone is on air plan mode.

Is there any other way to really check if even the wi-fi is enabled the mobile there is not internet connection?

Best regards,

Tiago Vital

Hi ,

    I am trying to show user friendly message instead of communication exception messsage(Requested Failed with an Error) when i try to call server.

I have implemented logic for network status in my client login but still i am getting "Requested Failed with an Error".How can i solve this?