You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Kore Nordmann (JIRA)" <ji...@apache.org> on 2008/04/16 12:51:21 UTC

[jira] Created: (COUCHDB-41) Differentiate between not exitant database and not existant document in response on 404

Differentiate between not exitant database and not existant document in response on 404
---------------------------------------------------------------------------------------

                 Key: COUCHDB-41
                 URL: https://issues.apache.org/jira/browse/COUCHDB-41
             Project: CouchDB
          Issue Type: Improvement
          Components: HTTP Interface
         Environment: CouchDB 0.7.2
            Reporter: Kore Nordmann
            Priority: Minor


Currently it is not possible to know from a request on a not existent document in the database, if the database does not exist, or if it is just the document which is missing.

It would be nice to have this information in the response JSON structure, so that the application using the CouchDB could handle such errors more gracefully. An extract from a CouchDB interaction showing the problem:

== Ensure database is absent

DELETE /test HTTP/1.0
Host: localhost

HTTP/1.0 404 Object Not Found
Server: inets/develop
Date: Tue, 15 Apr 2008 20:54:20 GMT
Cache-Control: no-cache
Pragma: no-cache
Expires: Tue, 15 Apr 2008 20:54:20 GMT
Connection: close
Content-Type: text/plain;charset=utf-8

{"error":"not_found","reason":"missing"}

== Try GET on absent database

GET /test/not_existant HTTP/1.0
Host: localhost

HTTP/1.0 404 Object Not Found
Server: inets/develop
Date: Tue, 15 Apr 2008 20:54:20 GMT
Cache-Control: no-cache
Pragma: no-cache
Expires: Tue, 15 Apr 2008 20:54:20 GMT
Connection: close
Content-Type: text/plain;charset=utf-8

{"error":"not_found","reason":"missing"}

== Create database, but not the document

PUT /test HTTP/1.0
Host: localhost

HTTP/1.0 201 Created
Server: inets/develop
Date: Tue, 15 Apr 2008 20:54:20 GMT
Cache-Control: no-cache
Pragma: no-cache
Expires: Tue, 15 Apr 2008 20:54:20 GMT
Connection: close
Content-Type: text/plain;charset=utf-8

{"ok":true}

== Try to fetch document again

GET /test/not_existant HTTP/1.0
Host: localhost

HTTP/1.0 404 Object Not Found
Server: inets/develop
Date: Tue, 15 Apr 2008 20:54:20 GMT
Cache-Control: no-cache
Pragma: no-cache
Expires: Tue, 15 Apr 2008 20:54:20 GMT
Connection: close
Content-Type: text/plain;charset=utf-8

{"error":"not_found","reason":"missing"}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COUCHDB-41) Differentiate between not existent database and not existant document in response on 404

Posted by "Kore Nordmann (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-41?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kore Nordmann updated COUCHDB-41:
---------------------------------

    Summary: Differentiate between not existent database and not existant document in response on 404  (was: Differentiate between not exitant database and not existant document in response on 404)

Fixed title, thanks Jan.

> Differentiate between not existent database and not existant document in response on 404
> ----------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-41
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-41
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: HTTP Interface
>         Environment: CouchDB 0.7.2
>            Reporter: Kore Nordmann
>            Priority: Minor
>
> Currently it is not possible to know from a request on a not existent document in the database, if the database does not exist, or if it is just the document which is missing.
> It would be nice to have this information in the response JSON structure, so that the application using the CouchDB could handle such errors more gracefully. An extract from a CouchDB interaction showing the problem:
> == Ensure database is absent
> DELETE /test HTTP/1.0
> Host: localhost
> HTTP/1.0 404 Object Not Found
> Server: inets/develop
> Date: Tue, 15 Apr 2008 20:54:20 GMT
> Cache-Control: no-cache
> Pragma: no-cache
> Expires: Tue, 15 Apr 2008 20:54:20 GMT
> Connection: close
> Content-Type: text/plain;charset=utf-8
> {"error":"not_found","reason":"missing"}
> == Try GET on absent database
> GET /test/not_existant HTTP/1.0
> Host: localhost
> HTTP/1.0 404 Object Not Found
> Server: inets/develop
> Date: Tue, 15 Apr 2008 20:54:20 GMT
> Cache-Control: no-cache
> Pragma: no-cache
> Expires: Tue, 15 Apr 2008 20:54:20 GMT
> Connection: close
> Content-Type: text/plain;charset=utf-8
> {"error":"not_found","reason":"missing"}
> == Create database, but not the document
> PUT /test HTTP/1.0
> Host: localhost
> HTTP/1.0 201 Created
> Server: inets/develop
> Date: Tue, 15 Apr 2008 20:54:20 GMT
> Cache-Control: no-cache
> Pragma: no-cache
> Expires: Tue, 15 Apr 2008 20:54:20 GMT
> Connection: close
> Content-Type: text/plain;charset=utf-8
> {"ok":true}
> == Try to fetch document again
> GET /test/not_existant HTTP/1.0
> Host: localhost
> HTTP/1.0 404 Object Not Found
> Server: inets/develop
> Date: Tue, 15 Apr 2008 20:54:20 GMT
> Cache-Control: no-cache
> Pragma: no-cache
> Expires: Tue, 15 Apr 2008 20:54:20 GMT
> Connection: close
> Content-Type: text/plain;charset=utf-8
> {"error":"not_found","reason":"missing"}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.