Search in sources :

Example 1 with CouchDbUnauthorizedException

use of me.retrodaredevil.couchdbjava.exception.CouchDbUnauthorizedException in project solarthing by wildmountainfarms.

the class CouchDbAlterDatabase method delete.

@Override
public void delete(String documentId, UpdateToken updateToken) throws SolarThingDatabaseException {
    RevisionUpdateToken revisionUpdateToken = CouchDbSolarThingDatabase.checkUpdateToken(updateToken);
    String revision = revisionUpdateToken.getRevision();
    try {
        database.deleteDocument(documentId, revision);
    } catch (CouchDbUnauthorizedException e) {
        throw new UnauthorizedSolarThingDatabaseException(e);
    } catch (CouchDbUpdateConflictException e) {
        throw new UpdateConflictSolarThingDatabaseException("Update conflict on delete. Must not be latest revision. documentId: " + documentId + " revision: " + revision, e);
    } catch (CouchDbNotFoundException e) {
        throw new NotFoundSolarThingDatabaseException("(Not found) Could not delete documentId: " + documentId + " revision: " + revision, e);
    } catch (CouchDbException e) {
        throw new SolarThingDatabaseException("Could not delete documentId: " + documentId + " revision: " + revision, e);
    }
}
Also used : CouchDbUnauthorizedException(me.retrodaredevil.couchdbjava.exception.CouchDbUnauthorizedException) CouchDbException(me.retrodaredevil.couchdbjava.exception.CouchDbException) CouchDbNotFoundException(me.retrodaredevil.couchdbjava.exception.CouchDbNotFoundException) UpdateConflictSolarThingDatabaseException(me.retrodaredevil.solarthing.database.exception.UpdateConflictSolarThingDatabaseException) UnauthorizedSolarThingDatabaseException(me.retrodaredevil.solarthing.database.exception.UnauthorizedSolarThingDatabaseException) NotFoundSolarThingDatabaseException(me.retrodaredevil.solarthing.database.exception.NotFoundSolarThingDatabaseException) CouchDbUpdateConflictException(me.retrodaredevil.couchdbjava.exception.CouchDbUpdateConflictException) NotFoundSolarThingDatabaseException(me.retrodaredevil.solarthing.database.exception.NotFoundSolarThingDatabaseException) UnauthorizedSolarThingDatabaseException(me.retrodaredevil.solarthing.database.exception.UnauthorizedSolarThingDatabaseException) UpdateConflictSolarThingDatabaseException(me.retrodaredevil.solarthing.database.exception.UpdateConflictSolarThingDatabaseException) SolarThingDatabaseException(me.retrodaredevil.solarthing.database.exception.SolarThingDatabaseException)

Aggregations

CouchDbException (me.retrodaredevil.couchdbjava.exception.CouchDbException)1 CouchDbNotFoundException (me.retrodaredevil.couchdbjava.exception.CouchDbNotFoundException)1 CouchDbUnauthorizedException (me.retrodaredevil.couchdbjava.exception.CouchDbUnauthorizedException)1 CouchDbUpdateConflictException (me.retrodaredevil.couchdbjava.exception.CouchDbUpdateConflictException)1 NotFoundSolarThingDatabaseException (me.retrodaredevil.solarthing.database.exception.NotFoundSolarThingDatabaseException)1 SolarThingDatabaseException (me.retrodaredevil.solarthing.database.exception.SolarThingDatabaseException)1 UnauthorizedSolarThingDatabaseException (me.retrodaredevil.solarthing.database.exception.UnauthorizedSolarThingDatabaseException)1 UpdateConflictSolarThingDatabaseException (me.retrodaredevil.solarthing.database.exception.UpdateConflictSolarThingDatabaseException)1