Line data Source code
1 : /*
2 : * Packge : Wilt
3 : * Author : S. Hamblett <steve.hamblett@linux.com>
4 : * Date : 04/06/2013
5 : * Copyright : S.Hamblett@OSCF
6 : *
7 : * This exception is thrown when Wilt has an internal error, such as an invalid
8 : * parameter being passed to a function.
9 : */
10 :
11 : part of wilt;
12 :
13 : class WiltException implements Exception {
14 : /* Exception message strings */
15 : static const String header = 'WiltException: ';
16 : static const String noDatabaseSpecified = 'No database specified';
17 : static const String getDocNoId = 'getDocument() must have a document id';
18 : static const String getDocRevNoId =
19 : 'getDocumentRevision() must have a document id';
20 : static const String deleteDocNoIdRev =
21 : 'deleteDocument() expects a document id and a revision';
22 : static const String putDocNoIdBody =
23 : 'putDocument() expects a document id and a document body';
24 : static const String putDocCantStringify =
25 : 'putDocument() cannot stringify the document body, use putDocumentString';
26 : static const String putDocStringNoIdBody =
27 : 'putDocumentString() expects a document id and a document body';
28 : static const String postDocNoBody = 'postDocument() expects a document body';
29 : static const String postDocCantStringify =
30 : 'postDocument() cannot stringify document body , use postDocumentString';
31 : static const String postDocStringNoBody =
32 : 'postDocumentString() expects a document body';
33 : static const String copyDocNoSrcId = 'copyDocument () expects a source id';
34 : static const String copyDocNoDestId =
35 : 'copyDocument () expects a destination id';
36 : static const String getAllDocsLimit =
37 : 'getAllDocs() must have a positive limit';
38 : static const String bulkNoDocList = 'bulk() must have a document list';
39 : static const String bulkCantStringify =
40 : 'bulk() cannot stringify document list, use bulkString';
41 : static const String bulkStringNoDoc =
42 : 'bulkString() must have a document string';
43 : static const String createDbNoName =
44 : 'createDatabase() expects a database name';
45 : static const String deleteDbNoName =
46 : 'deleteDatabase() expects a database name';
47 : static const String createAttNoDocId =
48 : 'createAttachment() expects a document id';
49 : static const String createAttNoName =
50 : 'createAttachment() expects an attachment name';
51 : static const String createAttNoRev = 'createAttachment() expects a revision';
52 : static const String createAttNoContentType =
53 : 'createAttachment() expects a content type';
54 : static const String createAttNoPayload =
55 : 'createAttachment() expects a payload';
56 : static const String updateAttNoDocId =
57 : 'updateAttachment() expects a document id';
58 : static const String updateAttNoName =
59 : 'updateAttachment() expects an attachment name';
60 : static const String updateAttNoRev = 'updateAttachment() expects a revision';
61 : static const String updateAttNoContentType =
62 : 'updateAttachment() expects a content type';
63 : static const String updateAttNoPayload =
64 : 'updateAttachment() expects a payload';
65 : static const String deleteAttNoDocId =
66 : 'deleteAttachment() expects a document id';
67 : static const String deleteAttNoName =
68 : 'deleteAttachment() expects an attachment name';
69 : static const String deleteAttNoRev = 'deleteAttachment() expects a revision';
70 : static const String getAttNoDocId = 'getAttachment() expects a document id';
71 : static const String getAttNoName =
72 : 'getAttachment() expects an attachment name';
73 : static const String updateCnpNoParams =
74 : 'updateChangeNotificationParameters() expects a parameter set';
75 : static const String updateCnpNoNotifier =
76 : 'updateChangeNotificationParameters() no change notifier';
77 : static const String loginWrongParams =
78 : 'Login() expects a non null user name and password';
79 : static const String genIdsAmount = 'generateIds() expects a positive amount';
80 : static const String badConstParams =
81 : 'Bad construction - some or all required parameters are null';
82 : static const String badConstNoAdapter =
83 : 'Bad construction - you must instantiate Wilt with a HTTP Adapter';
84 : static const String cnNoAuth = "Change Notifications must be authorized";
85 :
86 : /* Construction */
87 : String _message = 'No Message Supplied';
88 1 : WiltException([this._message]);
89 :
90 3 : String toString() => header + "${_message}";
91 : }
|