forked from contentstack/gatsby-source-contentstack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin-init.js
41 lines (35 loc) · 1.13 KB
/
plugin-init.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
'use strict';
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _ERROR_MAP;
var _require = require('./utils'),
CODES = _require.CODES;
var ERROR_MAP = (_ERROR_MAP = {}, (0, _defineProperty2["default"])(_ERROR_MAP, CODES.SyncError, {
text: function text(context) {
return context.sourceMessage;
},
level: "ERROR",
type: "PLUGIN"
}), (0, _defineProperty2["default"])(_ERROR_MAP, CODES.APIError, {
text: function text(context) {
return context.sourceMessage;
},
level: "ERROR",
type: "PLUGIN"
}), (0, _defineProperty2["default"])(_ERROR_MAP, CODES.ImageAPIError, {
text: function text(context) {
return context.sourceMessage;
},
level: "ERROR",
type: "PLUGIN"
}), (0, _defineProperty2["default"])(_ERROR_MAP, CODES.MissingDependencyError, {
text: function text(context) {
return context.sourceMessage;
},
level: "ERROR",
type: "PLUGIN"
}), _ERROR_MAP);
exports.onPluginInit = function (_ref) {
var reporter = _ref.reporter;
reporter.setErrorMap(ERROR_MAP);
};