2 Replies Latest reply on Nov 7, 2010 10:51 AM by igor1986

    Try Catch not work

    igor1986

      Hello! I have Flex Air app with AdvancedDataGrid. And I use filterFunction to filter data within it. Sometimes there are error occur - Error: Bookmark no longer valid. Then I placed code within try\catch block

       

       

       

       

       

      try {
            IHierarchicalCollectionView(TransactionsADG.dataProvider).refresh();
      }catch (errObject:Error) {
            Alert.show("'Bookmark is no longer valid' error occured");
      }

       

       

       

      But it seems that catch won't work, because alert.show operator don't implement.
      Here is the console stack trace:

       

      Error: Bookmark no longer valid.
      at ListCollectionViewCursor/seek()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\c ollections\ListCollectionView.as:2125]
      at mx.collections::HierarchicalCollectionViewCursor/get current()[C:\work\flex\dmv_automation\projects\datavisualisation\src\mx\collections\Hiera rchicalCollectionViewCursor.as:198]
      at mx.collections::HierarchicalCollectionViewCursor/collectionChangeHandler()[C:\work\flex\d mv_automation\projects\datavisualisation\src\mx\collections\HierarchicalCollectionViewCurs or.as:1056]
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at mx.collections::HierarchicalCollectionView/internalRefresh()[C:\work\flex\dmv_automation\ projects\datavisualisation\src\mx\collections\HierarchicalCollectionView.as:806]
      at mx.collections::HierarchicalCollectionView/refresh()[C:\work\flex\dmv_automation\projects \datavisualisation\src\mx\collections\HierarchicalCollectionView.as:686]
      at MyApp/filterTransactions()[C:\FlexProjectsMyApp\src\MyApp.mxml:4563]
      at MyApp/goToPrevMonth()[C:\FlexProjects\MyApp\src\MyApp.mxml:6823]
      at MyApp/__PrevMonthButton_click()[C:\FlexProjects\MyApp\src\MyApp.mxml:993]

       

      Any help would be appreciated. Thanks.

        • 1. Re: Try Catch not work
          Flex harUI Adobe Employee

          I think you can't catch errors thrown during dispatching of events.

           

          In AIR 2.0 there is an uncaughterror handler, but it would be better to

          figure out why the error is being thrown at all.

          1 person found this helpful
          • 2. Re: Try Catch not work
            igor1986 Level 1

            Thank you for response, I'll try uncaughterror handler.

            Of course it is better locate the error reason, but it have no strict steps to reproduce, sometimes it happen, sometimes not. Beside this, after error thrown code works properly in compiled app, I've googled it, but can't find clear answer why this error occured.

            Thank you again.