You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -38,11 +39,11 @@ export function transform (type) {
38
39
this._query[type][arguments[0]]=query;
39
40
returnthis;
40
41
}else{
41
-
console.error('Invalid parameters. Expected first parameter as a string (reference field UID) and second parameter as a string or an array of field names.');
console.error('Invalid parameters. Provide either one parameter (field name or array) or two parameters (reference field UID and field name or array).');
* Centralized error and informational messages for Contentstack JavaScript SDK
3
+
* @module messages
4
+
*/
5
+
6
+
constMESSAGES={
7
+
// Cache Provider Messages
8
+
CACHE_PROVIDER_MISSING: 'Missing cache provider. Provide a valid provider and try again.',
9
+
CACHE_POLICY_INVALID: 'Invalid cache policy. Provide a valid policy value and try again.',
10
+
11
+
// Stack Initialization Messages
12
+
STACK_INVALID_PARAMS_OBJECT: 'Invalid parameters. The specified API Key, Delivery Token, or Environment Name is invalid.',
13
+
STACK_INVALID_PARAMS_STRING: 'Invalid string parameters. Provide valid API Key, Delivery Token, and Environment Name.',
14
+
STACK_INVALID_PARAMS_GENERIC: 'Invalid parameters. Provide valid parameters to initialize the Contentstack javascript-SDK Stack.',
15
+
STACK_OBSOLETE_FUNCTION: "WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!",
16
+
17
+
// Entry Messages
18
+
ENTRY_UID_REQUIRED: "Entry UID required. Provide an entry UID. e.g. .Entry('entry_uid')",
19
+
ENTRY_INCLUDE_OWNER_DEPRECATED: 'The includeOwner function is deprecated. This functionality is no longer supported. Please remove this method from your code.',
20
+
ENTRY_INVALID_ARGUMENT: 'Invalid argument. Argument should be a String or an Array.',
21
+
ENTRY_LANGUAGE_INVALID: 'Invalid language code. Argument should be a String.',
22
+
ENTRY_ADD_QUERY_INVALID: 'Invalid query parameters. First argument should be a String.',
23
+
ENTRY_ADD_PARAM_INVALID: 'Invalid parameters. Both key and value should be strings.',
24
+
25
+
// Query/Transform Messages (only/except)
26
+
TRANSFORM_INVALID_SINGLE_PARAM: 'Invalid parameters. Expected a string or an array of field names.',
27
+
TRANSFORM_INVALID_DOUBLE_PARAM: 'Invalid parameters. Expected first parameter as a string (reference field UID) and second parameter as a string or an array of field names.',
28
+
TRANSFORM_INVALID_PARAM_COUNT: 'Invalid parameters. Provide either one parameter (field name or array) or two parameters (reference field UID and field name or array).',
Copy file name to clipboardExpand all lines: src/core/stack.js
+11-10Lines changed: 11 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,7 @@ import Query from './modules/query';
6
6
importTaxonomyfrom'./modules/taxonomy';
7
7
importRequestfrom'./lib/request';
8
8
importCacheProviderfrom'./cache-provider/index';
9
+
importMESSAGESfrom'./messages';
9
10
consterrorRetry=[408,429];
10
11
11
12
/**
@@ -118,10 +119,10 @@ export default class Stack {
118
119
this.environment=stack_arguments[0].environment;
119
120
returnthis;
120
121
}else{
121
-
if(this.fetchOptions.debug)this.fetchOptions.logHandler('error','Kindly provide valid object parameters. The specified API Key, Delivery Token, or Environment Name is invalid.');
if(this.fetchOptions.debug)this.fetchOptions.logHandler('warning',"WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!");
if(this.fetchOptions.debug)this.fetchOptions.logHandler('warning',"WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!");
@@ -152,15 +153,15 @@ export default class Stack {
152
153
}
153
154
returnthis;
154
155
case5:
155
-
if(this.fetchOptions.debug)this.fetchOptions.logHandler('warning',"WARNING! Obsolete function called. Function 'Contentstack.Stack(api_key, delivery_token, environment)' has been deprecated, please use 'Contentstack.Stack({api_key, delivery_token, environment, region, branch, fetchOptions})' function instead!");
if(this.fetchOptions.debug)this.fetchOptions.logHandler('error','Kindly provide valid parameters to initialize the Contentstack javascript-SDK Stack.');
0 commit comments