UNPKG

@botonic/plugin-contentful

Version:

Botonic Plugin Contentful is one of the **[available](https://github.com/hubtype/botonic/tree/master/packages)** plugins for Botonic. **[Contentful](http://www.contentful.com)** is a CMS (Content Management System) which manages contents of a great variet

65 lines 2.64 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ErrorReportingManageCms = void 0; const tslib_1 = require("tslib"); const cms_1 = require("../cms"); class ErrorReportingManageCms { constructor(manageCms, logErrors = true) { this.manageCms = manageCms; this.logErrors = logErrors; this.exceptionWrapper = new cms_1.ContentfulExceptionWrapper('ManageCms'); } updateFields(context, contentId, fields) { return this.manageCms .updateFields(context, contentId, fields) .catch(this.handleError('updateFields', context, contentId, fields)); } deleteContent(context, contentId) { return this.manageCms .deleteContent(context, contentId) .catch(this.handleError('deleteContent', undefined, contentId, {})); } createContent(context, model, id) { return tslib_1.__awaiter(this, void 0, void 0, function* () { return this.manageCms .createContent(context, model, id) .catch(this.handleError('createContent', undefined, new cms_1.ContentId(model, id), {})); }); } copyField(context, contentId, field, fromLocale, onlyIfTargetEmpty) { return this.manageCms .copyField(context, contentId, field, fromLocale, onlyIfTargetEmpty) .catch(this.handleError('copyField', context, contentId, { field, fromLocale, onlyIfTargetEmpty, })); } handleError(method, context, resourceId, args) { return (reason) => { throw this.exceptionWrapper.wrap(reason, method, resourceId, args, context); }; } copyAssetFile(context, assetId, fromLocale) { return this.manageCms .copyAssetFile(context, assetId, fromLocale) .catch(this.handleError('copyAssetFile', context, assetId, { fromLocale })); } removeAssetFile(context, assetId) { return this.manageCms .removeAssetFile(context, assetId) .catch(this.handleError('removeAssetFile', context, assetId, {})); } createAsset(context, file, info) { return this.manageCms .createAsset(context, file, info) .catch(this.handleError('createAsset', undefined, undefined, {})); } removeAsset(context, assetId) { return this.manageCms .removeAsset(context, assetId) .catch(this.handleError('removeAsset', undefined, assetId, {})); } } exports.ErrorReportingManageCms = ErrorReportingManageCms; //# sourceMappingURL=manage-cms-error.js.map