locked
Handling exception thrown from 'then' RRS feed

  • Question

  •  What will happen if I don't handle then's error. I am using Async file open/read/write promises with 'then'. I read the unhandled exceptions from 'then' are silently captured as part of the state of the promise. Will it continue even if the full data is not recovered from the files?. Can I handle the onerror and display a message box?  Thanks.


    karthika

    Tuesday, May 14, 2013 3:09 PM

Answers

  • If handled the execution would typically execute what is there in the onerror function. Since you are using async operation what ever is outside of the "then" would any way execute.

    Yes you can show the error using MessageDialog

    Typically the flow is like this :

    <async operation>.then(
    function(obj)
    {
    // Sucessfully completed 
    // do other stuff with result
    },
    function(err)
    {
    //error encountered
    // Show message and donot proceed
    }
    );
    
    // Other operations here 

    - Girija

     

     


    Tuesday, May 14, 2013 6:35 PM