Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7651335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:28:48+00:00 2026-05-31T11:28:48+00:00

Here is an issue i’m struggling to solve for quit some time now. I

  • 0

Here is an issue i’m struggling to solve for quit some time now.
I have a python + GAE backend with a flex client that communicates via JSON. I’m using flex’s HttpService bound to a Responder with result and fault callbacks.

When python raises an exception, I don’t seem to get it in flex. I did some research and found out that the problem probably lies in the fact that the flash runtime cannot handle http responses with status code other than 200.

So how do I get those exceptions in the client?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T11:28:49+00:00Added an answer on May 31, 2026 at 11:28 am

    TL;DR – Catch exception in Python and send a custom JSON object, with the message you want to display to the client, back to Flex.

    This is the pattern I follow. The example I am going to give is in C# but I am assuming the same principles can be applied to Python.

    I handle the exception in the web service and send a JSON object containing the error I would like to display to the user.

    Here I am catching the error:

    try
    {
        string jsonResponse = doStuff();
    
        return Json(jsonResponse, JsonRequestBehavior.AllowGet);
    }
    catch (Exception ex)
    {
        return Json(new GetTokenError(ex.Message), JsonRequestBehavior.AllowGet);
    }
    

    Here is the return object I use to convert to JSON and return to the client:

    /// <summary>
    /// Used for displaying consistent error messages
    /// </summary>
    public class GetTokenError
    {
        /// <summary>
        /// Ctor
        /// </summary>
        /// <param name="error">Error message to display</param>
        public GetTokenError(string error)
        {
            this.error = error;
        }
    
        /// <summary>
        /// The error to display
        /// </summary>
        public string error { get; set; }
    }
    

    Using this method will always return a 200 unless there is something wrong with your web server, the connection between the client and web server, or gremlins have infected your machine.

    As for the flex side, here are my result handlers:

    var http:HTTPService = new HTTPService();
    http.method = "POST";
    http.resultFormat = HTTPService.RESULT_FORMAT_TEXT;
    http.url = "http://url.com";
    http.addEventListener(ResultEvent.RESULT, function(evt:ResultEvent):void {
        try {
            var ret:Object = JSON.decode(evt.result.toString());
    
            if (ret.error)
            {
                // handle server error
            }
    
            // go about task
    
        } catch (e:Error) {
            // handle local error
        }
    });
    
    http.addEventListener(FaultEvent.FAULT, function(ex:FaultEvent):void {
        // handle error with the call
    });
    
    http.send();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some issue here which I don't know how to solve in a
I am having some weird issue here. I have a database table which has
I have a very painful issue here, if some one could help ? I
I have a bit of an issue here. I have a Python script which
I have some weird issue here as somehow I am unable to pass NSString
Having an issue here that I have tried everything I can think of but
I have a rather annoying issue here I can't get my CheckBox CheckedChange event
I have a curious issue here In my ejbCreate() method from where i insert
Hey guys I have a little issue here. I have a panel where I
Have another issue here. Our app starts out with a tab activity. But, before

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.