How to display different messages based on the responseContent?

Hi guys, I have a login authentication feature (linked to Firebase) that will tell me eg Invalid Email, Invalid Password etc.

However, instead of showing the whole "ugly" responseContent, how do I make it such that the notifier tells the user exact what the main issue is
Thanks!!

You may be able to trap the message using one of these blocks understandibleErrorMsg

depending on whether the error is originating from Firebase or somewhere else (your log in code Blocks).

Parse the message and place the result in your Notifier.

Hi Steve,

Thanks for your response!

I tried both blocks, but am not able to get any results/notifier message:


Am I doing it correctly?

Thanks!!

where does the response content come from? these are the 3 possibilities depending on what you are doing...

Web.GotText
FirebaseDB.FirebaseError
Screen.ErrorOccurred

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

Try, in the Web GotText

If responseCode = 200 then

     do all that stuff you are attempting in your current GotText

else Notifier1.ShowAlert notice =responseType ( edit, this should be responseContent , not type, ) using the orange blocks in the GotText sri, typed too fast.

Hihi Steve, just tried it and this is my response:

Hi Taifun,

Hmm I suspect could be error from gottext?

ok, you tried the sugestion from @SteveJG, and as we can see, the response type will now be displayed, which actually is not want you want in the end...

what you want is to get the respnse content as you had it earlier and parse the response content to display only the error, for example INVALID_PASSWORD
the response content is in JSON format, you can use the JsonTextDecodeWithDictionaries method from the web component to convert it into a dictionary

Taifun

Note Taifun's comments ... responseType should be responseContent. Sri, typed too fast.

A better way to avoid some of the errors would be to check the contents of your input TextBlocks immediately ahead of your Web.Get instruction. Always better to avoid input errors than to trap them if you can.

Hi Steve and Taifun,

Thanks for all the help, I really appreciate it! My issue has been resolved :slight_smile:

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.