27
Views
5
Comments
Handling Invalid Login exception - Mobile
Question

Hello guys,


It seems that I'm not able to catch the Invalid Login thrown by the Users module on mobile. It's just something simple to change the message shown (we want 'invalid credentials' instead of the default)

Here's my log in exception handling.



Then of course if you debug: 


But while debugging, it's caught by the All Exceptions handler. 

I thought that the exception should be handled by the most specific handler? Here in the Users module we see that InvalidLogInException is thrown



Any idea why it's getting caught by the AllExceptions instead of the more specific InvalidLogin ?

Rank: #105

Hi Mariano,


Given the nature of the Users module, this cannot be changed by none other than OutSystems.

To catch it, you really have to parse the message on the handler from your side and see if it is the "Invalid username or password" message and then show your own.


Recently, quite a few people also have had this problem since the translations in many languages are not included in the Users and this workaround needs to be in place.


Hope it helps.


João

Rank: #363

That was my first instinct João but it's not very fail safe, if Outsystems decide to change their error message to "Your login was incorrect" then the handler stops working? I can't see why the exception, which is thrown and recognized in the list, can't simply be caught.


Security exception is caught by the global handler, and is the one that denies you entry to pages:

But even trying to catch this one on the log in action, it goes to the AllExceptions handler.

This needs to be addressed

Rank: #105

It is not at all safe, pretty or the way it should be done, I fully agree with you.

I want to think that such an update on Users will include this on the Release Notes so people are aware of that.


But given the current situation, I don't see another option than the one I mentioned and it is the one applied to also translate this message in a past experience.

Rank: #136

Hi Mariano,


The statement by Outsystems that the most specific of exception handlers is used for handling a thrown exception, is not holding up in reality.  Yours is just one example.  

I did some tests, see my conclusions in this post.

I would recommend you to submit a bug report.


Dorine

Rank: #363

Hello, Dorine,

Late reply but I must have forgotten. I submitted a bug report or hopefully it could be a possible improvement for further versions, but it's silly that the exception loses it's specificity through modules, that doesn't tend to happen in any other programming language which I'm used to. If it throws, it can be caught and handled. 


Hoping for the best.