case CodeResponse::Code::NO_BUCKET:
LOGE("Trying to use unexisting bucket.");
return CYNARA_API_BUCKET_NOT_FOUND;
+ case CodeResponse::Code::FAILED:
+ LOGC("Cynara service answered: Operation failed.");
+ return CYNARA_API_OPERATION_FAILED;
default:
LOGE("Unexpected response code from server: [%d]",
static_cast<int>(codeResponse->m_code));
/*! \brief cynara service does not allow to perform requested operation */
#define CYNARA_API_OPERATION_NOT_ALLOWED -7
+/*! \brief cynara service failed to perform requested operation */
+#define CYNARA_API_OPERATION_FAILED -8
+
/*! \brief cynara service hasn't found requested bucket */
-#define CYNARA_API_BUCKET_NOT_FOUND -8
+#define CYNARA_API_BUCKET_NOT_FOUND -9
/*! \brief indicating an unknown error */
-#define CYNARA_API_UNKNOWN_ERROR -9
+#define CYNARA_API_UNKNOWN_ERROR -10
/** @}*/
#include <log/log.h>
#include <common.h>
#include <exceptions/BucketNotExistsException.h>
+#include <exceptions/DatabaseException.h>
#include <exceptions/DefaultBucketDeletionException.h>
#include <exceptions/DefaultBucketSetNoneException.h>
#include <exceptions/PluginErrorException.h>
try {
m_storage->addOrUpdateBucket(request->bucketId(), request->result());
onPoliciesChanged();
+ } catch (const DatabaseException &ex) {
+ code = CodeResponse::Code::FAILED;
} catch (const DefaultBucketSetNoneException &ex) {
code = CodeResponse::Code::NOT_ALLOWED;
}
try {
m_storage->deleteBucket(request->bucketId());
onPoliciesChanged();
+ } catch (const DatabaseException &ex) {
+ code = CodeResponse::Code::FAILED;
} catch (const BucketNotExistsException &ex) {
code = CodeResponse::Code::NO_BUCKET;
} catch (const DefaultBucketDeletionException &ex) {
m_storage->insertPolicies(request->policiesToBeInsertedOrUpdated());
m_storage->deletePolicies(request->policiesToBeRemoved());
onPoliciesChanged();
+ } catch (const DatabaseException &ex) {
+ code = CodeResponse::Code::FAILED;
} catch (const BucketNotExistsException &ex) {
code = CodeResponse::Code::NO_BUCKET;
}