Cleaned up panic handling
authorteknolog
Sun, 04 Apr 2010 18:52:11 +0100
changeset 114 27f6f5827e5d
parent 113 50345a6ad0c3
child 115 d87e984bd8b8
Cleaned up panic handling
application/src/PodcastFeedView.cpp
application/src/PodcastFeedViewUpdater.cpp
engine/inc/Podcatcher.pan
engine/src/FeedEngine.cpp
engine/src/HttpClient.cpp
engine/src/PodcastModel.cpp
--- a/application/src/PodcastFeedView.cpp	Sun Apr 04 18:38:49 2010 +0100
+++ b/application/src/PodcastFeedView.cpp	Sun Apr 04 18:52:11 2010 +0100
@@ -32,7 +32,7 @@
 #include <BAUTILS.H> 
 #include <pathinfo.h> 
 #include <akncommondialogsdynmem.h> 
-
+#include "Podcatcher.pan"
 
 const TInt KMaxFeedNameLength = 100;
 const TInt KMaxUnplayedFeedsLength =64;
@@ -132,12 +132,11 @@
 
 void CPodcastFeedView::UpdateItemL(TInt aIndex)
 	{
-	_LIT(KPanicCategory, "CPodcastFeedView::UpdateItemL");
-	__ASSERT_DEBUG(iListContainer->IsVisible(), User::Panic(KPanicCategory, 0));
-	__ASSERT_ALWAYS(iItemIdArray.Count() > aIndex, User::Panic(KPanicCategory, 1));
+	__ASSERT_DEBUG(iListContainer->IsVisible(), Panic(EPodcatcherPanicFeedView));
+	__ASSERT_ALWAYS(iItemIdArray.Count() > aIndex, Panic(EPodcatcherPanicFeedView));
 
 	const RFeedInfoArray& sortedItems = iPodcastModel.FeedEngine().GetSortedFeeds();
-	__ASSERT_ALWAYS(sortedItems.Count() > aIndex, User::Panic(KPanicCategory, 2));
+	__ASSERT_ALWAYS(sortedItems.Count() > aIndex, Panic(EPodcatcherPanicFeedView));
 
 	// Update UID of for the feed at aIndex
 	iItemIdArray[aIndex] = sortedItems[aIndex]->Uid();
--- a/application/src/PodcastFeedViewUpdater.cpp	Sun Apr 04 18:38:49 2010 +0100
+++ b/application/src/PodcastFeedViewUpdater.cpp	Sun Apr 04 18:52:11 2010 +0100
@@ -65,8 +65,6 @@
 
 void CPodcastFeedViewUpdater::RunL()
 	{
-	_LIT(KPanicCategory, "CPodcastFeedViewUpdater::RunL");
-	__ASSERT_DEBUG(iNextItem < iNbrItems, User::Panic(KPanicCategory, 0));
 	iPodcastFeedView.UpdateItemL(iNextItem++);
 	if (iNextItem < iNbrItems)
 		{
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/engine/inc/Podcatcher.pan	Sun Apr 04 18:52:11 2010 +0100
@@ -0,0 +1,37 @@
+/*
+* Copyright (c) 2010 Sebastian Brannstrom
+*
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* EmbedDev AB - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef __PODCATCHER_PAN__
+#define __PODCATCHER_PAN__
+
+enum TPodcatcherPanics
+    {
+    EPodcatcherPanicDB = 1,
+    EPodcatcherPanicAlreadyActive,
+    EPodcatcherPanicFeedEngineState,
+    EPodcatcherPanicFeedView
+    };
+
+
+inline void Panic(TPodcatcherPanics aReason)
+    {
+    _LIT(applicationName,"Podcatcher");
+    User::Panic(applicationName, aReason);
+    }
+
+#endif
--- a/engine/src/FeedEngine.cpp	Sun Apr 04 18:38:49 2010 +0100
+++ b/engine/src/FeedEngine.cpp	Sun Apr 04 18:52:11 2010 +0100
@@ -26,6 +26,7 @@
 #include "OpmlParser.h"
 #include "PodcastUtils.h"
 #include <utf.h>
+#include "Podcatcher.pan"
 
 _LIT(KFeedParseStorePath, "feeds\\");
 
@@ -655,7 +656,7 @@
 			BaflUtils::DeleteFile(iPodcastModel.FsSession(), iSearchResultsFileName);
 			}break;
 		default:
-			User::Panic(_L("FeedEngine"), KErrUnknown);
+			Panic(EPodcatcherPanicFeedEngineState);
 			break;
 		}
 	DP("CFeedEngine::CompleteL END");
--- a/engine/src/HttpClient.cpp	Sun Apr 04 18:38:49 2010 +0100
+++ b/engine/src/HttpClient.cpp	Sun Apr 04 18:52:11 2010 +0100
@@ -14,6 +14,7 @@
 #include "HttpClient.h"
 #include "connectionengine.h"
 #include "settingsengine.h"
+#include "Podcatcher.pan"
 
 const TInt KTempBufferSize = 100;
 
@@ -192,7 +193,7 @@
 TBool CHttpClient::GetL(const TDesC& aUrl, const TDesC& aFileName,  TBool aSilent) {
 	DP("CHttpClient::Get START");
 	DP2("Getting '%S' to '%S'", &aUrl, &aFileName);	
-	__ASSERT_DEBUG((iIsActive==EFalse), User::Panic(_L("Already active"), -2));
+	__ASSERT_DEBUG((iIsActive==EFalse), Panic(EPodcatcherPanicAlreadyActive));
 	iCurrentURL.Copy(aUrl);	
 		
 	TInt urlError = iUriParser.Parse(iCurrentURL);
--- a/engine/src/PodcastModel.cpp	Sun Apr 04 18:38:49 2010 +0100
+++ b/engine/src/PodcastModel.cpp	Sun Apr 04 18:52:11 2010 +0100
@@ -23,6 +23,7 @@
 #include "ShowEngine.h"
 #include "connectionengine.h"
 #include "podcastutils.h"
+#include "Podcatcher.pan"
 
 #include <cmdestination.h>
 #include <cmmanager.h>
@@ -95,7 +96,7 @@
 		
 		if (err != KErrNone)
 			{
-			User::Panic(_L("Podcatcher"), 1);
+			Panic(EPodcatcherPanicDB);
 			}
 		
 		}