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

61 lines 2.48 kB
import { __awaiter } from "tslib"; import { ContentfulExceptionWrapper, ContentId, } from '../cms'; export class ErrorReportingManageCms { constructor(manageCms, logErrors = true) { this.manageCms = manageCms; this.logErrors = logErrors; this.exceptionWrapper = new 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 __awaiter(this, void 0, void 0, function* () { return this.manageCms .createContent(context, model, id) .catch(this.handleError('createContent', undefined, new 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, {})); } } //# sourceMappingURL=manage-cms-error.js.map