|
1 /* |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 #include "CPixNPExceptions.h" |
|
18 #include <Common.h> |
|
19 |
|
20 #include <e32err.h> |
|
21 |
|
22 const TDesC8* DescribeErrorCode( TInt aErrorCode ) |
|
23 { |
|
24 switch ( aErrorCode ) |
|
25 { |
|
26 // CPix error codes |
|
27 case KErrCannotOpenDatabase: |
|
28 return &KCPixNPCannotOpenDatabaseException(); |
|
29 case KErrQueryParsingFailed: |
|
30 return &KCPixNPQueryParsingFailedException(); |
|
31 case KErrDatabaseQueryFailed: |
|
32 return &KCPixNPDatabaseQueryFailedException(); |
|
33 case KErrDocumentAccessFailed: |
|
34 return &KCPixNPDocumentAccessFailedException(); |
|
35 |
|
36 // Indexing errors (should not be possible to occur) |
|
37 case KErrCannotAddDocument: |
|
38 case KErrCannotUpdateDocument: |
|
39 case KErrDatabaseFlushFailed: |
|
40 case KErrCannotCreateDocument: |
|
41 case KErrCannotCreateDocumentField: |
|
42 case KErrCannotCreateQueryParser: |
|
43 case KErrCannotCreateAnalyzer: |
|
44 return &KCPixNPInternalError(); |
|
45 |
|
46 // System wide error codes |
|
47 case KErrNone: |
|
48 return NULL; |
|
49 case KErrInUse: |
|
50 return &KCPixNPInUseException(); |
|
51 case KErrServerTerminated: |
|
52 return &KCPixNPServerTerminated(); |
|
53 case KErrServerBusy: |
|
54 return &KCPixNPServerBusy(); |
|
55 case KErrCouldNotConnect: |
|
56 return &KCPixNPCouldNotConnect(); |
|
57 |
|
58 // At least this is our fault |
|
59 case KErrArgument: |
|
60 return &KCPixNPInternalError(); |
|
61 |
|
62 // Fallback |
|
63 default: |
|
64 return &KCPixNPUnknownException(); |
|
65 |
|
66 } |
|
67 } |