forked from couchbaselabs/TouchDB-iOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TDStatus.h
51 lines (40 loc) · 1.65 KB
/
TDStatus.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
//
// TDStatus.h
// TouchDB
//
// Created by Jens Alfke on 4/5/12.
// Copyright (c) 2012 Couchbase, Inc. All rights reserved.
//
/** TouchDB internal status/error codes. Superset of HTTP status codes. */
typedef enum {
kTDStatusOK = 200,
kTDStatusCreated = 201,
kTDStatusAccepted = 206,
kTDStatusNotModified = 304,
kTDStatusBadRequest = 400,
kTDStatusUnauthorized = 401,
kTDStatusForbidden = 403,
kTDStatusNotFound = 404,
kTDStatusNotAcceptable = 406,
kTDStatusConflict = 409,
kTDStatusDuplicate = 412, // Formally known as "Precondition Failed"
kTDStatusUnsupportedType= 415,
kTDStatusServerError = 500,
// Non-HTTP errors:
kTDStatusBadEncoding = 490,
kTDStatusBadAttachment = 491,
kTDStatusAttachmentNotFound = 492,
kTDStatusBadJSON = 493,
kTDStatusBadID = 494,
kTDStatusBadParam = 495,
kTDStatusDeleted = 496, // Document deleted
kTDStatusUpstreamError = 589, // Error from remote replication server
kTDStatusDBError = 590, // SQLite error
kTDStatusCorruptError = 591, // bad data in database
kTDStatusAttachmentError= 592, // problem with attachment store
kTDStatusCallbackError = 593, // app callback (emit fn, etc.) failed
kTDStatusException = 594, // Exception raised/caught
} TDStatus;
static inline bool TDStatusIsError(TDStatus status) {return status >= 300;}
int TDStatusToHTTPStatus( TDStatus status, NSString** outMessage );
NSError* TDStatusToNSError( TDStatus status, NSURL* url );