diff --git a/badge-maker_lib_index.js.html b/badge-maker_lib_index.js.html index 1a7fb34c1b..4c5844e79d 100644 --- a/badge-maker_lib_index.js.html +++ b/badge-maker_lib_index.js.html @@ -123,7 +123,7 @@ module.exports = {
diff --git a/badge-maker_lib_xml.js.html b/badge-maker_lib_xml.js.html index 4474b0d4bc..4f6850ec2e 100644 --- a/badge-maker_lib_xml.js.html +++ b/badge-maker_lib_xml.js.html @@ -138,7 +138,7 @@ module.exports = { escapeXml, stripXmlWhitespace, XmlElement, ElementList }
diff --git a/core_base-service_base-graphql.js.html b/core_base-service_base-graphql.js.html index 8f5a4be75c..c8488e60da 100644 --- a/core_base-service_base-graphql.js.html +++ b/core_base-service_base-graphql.js.html @@ -72,6 +72,12 @@ class BaseGraphqlService extends BaseService { * and custom error messages e.g: `{ 404: 'package not found' }`. * This can be used to extend or override the * [default](https://github.com/badges/shields/blob/master/core/base-service/check-error-response.js#L5) + * @param {object} [attrs.systemErrors={}] Key-value map of got network exception codes + * and an object of params to pass when we construct an Inaccessible exception object + * e.g: `{ ECONNRESET: { prettyMessage: 'connection reset' } }`. + * See {@link https://github.com/sindresorhus/got/blob/main/documentation/7-retry.md#errorcodes got error codes} + * for allowed keys + * and {@link module:core/base-service/errors~RuntimeErrorProps} for allowed values * @param {Function} [attrs.transformJson=data => data] Function which takes the raw json and transforms it before * further procesing. In case of multiple query in a single graphql call and few of them * throw error, partial data might be used ignoring the error. @@ -90,6 +96,7 @@ class BaseGraphqlService extends BaseService { variables = {}, options = {}, httpErrorMessages = {}, + systemErrors = {}, transformJson = data => data, transformErrors = defaultTransformErrors, }) { @@ -102,7 +109,8 @@ class BaseGraphqlService extends BaseService { const { buffer } = await this._request({ url, options: mergedOptions, - errorMessages: httpErrorMessages, + httpErrors: httpErrorMessages, + systemErrors, }) const json = transformJson(this._parseJson(buffer)) if (json.errors) { @@ -136,7 +144,7 @@ export default BaseGraphqlService
diff --git a/core_base-service_base-json.js.html b/core_base-service_base-json.js.html index 1668b107e4..3f451b6ae6 100644 --- a/core_base-service_base-json.js.html +++ b/core_base-service_base-json.js.html @@ -58,14 +58,26 @@ class BaseJsonService extends BaseService { * @param {string} attrs.url URL to request * @param {object} [attrs.options={}] Options to pass to got. See * [documentation](https://github.com/sindresorhus/got/blob/main/documentation/2-options.md) - * @param {object} [attrs.errorMessages={}] Key-value map of status codes + * @param {object} [attrs.httpErrors={}] Key-value map of status codes * and custom error messages e.g: `{ 404: 'package not found' }`. * This can be used to extend or override the * [default](https://github.com/badges/shields/blob/master/core/base-service/check-error-response.js#L5) + * @param {object} [attrs.systemErrors={}] Key-value map of got network exception codes + * and an object of params to pass when we construct an Inaccessible exception object + * e.g: `{ ECONNRESET: { prettyMessage: 'connection reset' } }`. + * See {@link https://github.com/sindresorhus/got/blob/main/documentation/7-retry.md#errorcodes got error codes} + * for allowed keys + * and {@link module:core/base-service/errors~RuntimeErrorProps} for allowed values * @returns {object} Parsed response * @see https://github.com/sindresorhus/got/blob/main/documentation/2-options.md */ - async _requestJson({ schema, url, options = {}, errorMessages = {} }) { + async _requestJson({ + schema, + url, + options = {}, + httpErrors = {}, + systemErrors = {}, + }) { const mergedOptions = { ...{ headers: { Accept: 'application/json' } }, ...options, @@ -73,7 +85,8 @@ class BaseJsonService extends BaseService { const { buffer } = await this._request({ url, options: mergedOptions, - errorMessages, + httpErrors, + systemErrors, }) const json = this._parseJson(buffer) return this.constructor._validate(json, schema) @@ -97,7 +110,7 @@ export default BaseJsonService
diff --git a/core_base-service_base-svg-scraping.js.html b/core_base-service_base-svg-scraping.js.html index 7b5bfb947c..0e33850d99 100644 --- a/core_base-service_base-svg-scraping.js.html +++ b/core_base-service_base-svg-scraping.js.html @@ -81,10 +81,16 @@ class BaseSvgScrapingService extends BaseService { * @param {string} attrs.url URL to request * @param {object} [attrs.options={}] Options to pass to got. See * [documentation](https://github.com/sindresorhus/got/blob/main/documentation/2-options.md) - * @param {object} [attrs.errorMessages={}] Key-value map of status codes + * @param {object} [attrs.httpErrors={}] Key-value map of status codes * and custom error messages e.g: `{ 404: 'package not found' }`. * This can be used to extend or override the * [default](https://github.com/badges/shields/blob/master/core/base-service/check-error-response.js#L5) + * @param {object} [attrs.systemErrors={}] Key-value map of got network exception codes + * and an object of params to pass when we construct an Inaccessible exception object + * e.g: `{ ECONNRESET: { prettyMessage: 'connection reset' } }`. + * See {@link https://github.com/sindresorhus/got/blob/main/documentation/7-retry.md#errorcodes got error codes} + * for allowed keys + * and {@link module:core/base-service/errors~RuntimeErrorProps} for allowed values * @returns {object} Parsed response * @see https://github.com/sindresorhus/got/blob/main/documentation/2-options.md */ @@ -93,7 +99,8 @@ class BaseSvgScrapingService extends BaseService { valueMatcher, url, options = {}, - errorMessages = {}, + httpErrors = {}, + systemErrors = {}, }) { const logTrace = (...args) => trace.logTrace('fetch', ...args) const mergedOptions = { @@ -103,7 +110,8 @@ class BaseSvgScrapingService extends BaseService { const { buffer } = await this._request({ url, options: mergedOptions, - errorMessages, + httpErrors, + systemErrors, }) logTrace(emojic.dart, 'Response SVG', buffer) const data = { @@ -133,7 +141,7 @@ export default BaseSvgScrapingService
diff --git a/core_base-service_base-xml.js.html b/core_base-service_base-xml.js.html index d059a3dfaf..6680ec164b 100644 --- a/core_base-service_base-xml.js.html +++ b/core_base-service_base-xml.js.html @@ -52,10 +52,16 @@ class BaseXmlService extends BaseService { * @param {string} attrs.url URL to request * @param {object} [attrs.options={}] Options to pass to got. See * [documentation](https://github.com/sindresorhus/got/blob/main/documentation/2-options.md) - * @param {object} [attrs.errorMessages={}] Key-value map of status codes + * @param {object} [attrs.httpErrors={}] Key-value map of status codes * and custom error messages e.g: `{ 404: 'package not found' }`. * This can be used to extend or override the * [default](https://github.com/badges/shields/blob/master/core/base-service/check-error-response.js#L5) + * @param {object} [attrs.systemErrors={}] Key-value map of got network exception codes + * and an object of params to pass when we construct an Inaccessible exception object + * e.g: `{ ECONNRESET: { prettyMessage: 'connection reset' } }`. + * See {@link https://github.com/sindresorhus/got/blob/main/documentation/7-retry.md#errorcodes got error codes} + * for allowed keys + * and {@link module:core/base-service/errors~RuntimeErrorProps} for allowed values * @param {object} [attrs.parserOptions={}] Options to pass to fast-xml-parser. See * [documentation](https://github.com/NaturalIntelligence/fast-xml-parser#xml-to-json) * @returns {object} Parsed response @@ -66,7 +72,8 @@ class BaseXmlService extends BaseService { schema, url, options = {}, - errorMessages = {}, + httpErrors = {}, + systemErrors = {}, parserOptions = {}, }) { const logTrace = (...args) => trace.logTrace('fetch', ...args) @@ -77,7 +84,8 @@ class BaseXmlService extends BaseService { const { buffer } = await this._request({ url, options: mergedOptions, - errorMessages, + httpErrors, + systemErrors, }) const validateResult = XMLValidator.validate(buffer) if (validateResult !== true) { @@ -112,7 +120,7 @@ export default BaseXmlService
diff --git a/core_base-service_base-yaml.js.html b/core_base-service_base-yaml.js.html index c7bd292680..8ef0b8919b 100644 --- a/core_base-service_base-yaml.js.html +++ b/core_base-service_base-yaml.js.html @@ -51,10 +51,16 @@ class BaseYamlService extends BaseService { * @param {string} attrs.url URL to request * @param {object} [attrs.options={}] Options to pass to got. See * [documentation](https://github.com/sindresorhus/got/blob/main/documentation/2-options.md) - * @param {object} [attrs.errorMessages={}] Key-value map of status codes + * @param {object} [attrs.httpErrors={}] Key-value map of status codes * and custom error messages e.g: `{ 404: 'package not found' }`. * This can be used to extend or override the * [default](https://github.com/badges/shields/blob/master/core/base-service/check-error-response.js#L5) + * @param {object} [attrs.systemErrors={}] Key-value map of got network exception codes + * and an object of params to pass when we construct an Inaccessible exception object + * e.g: `{ ECONNRESET: { prettyMessage: 'connection reset' } }`. + * See {@link https://github.com/sindresorhus/got/blob/main/documentation/7-retry.md#errorcodes got error codes} + * for allowed keys + * and {@link module:core/base-service/errors~RuntimeErrorProps} for allowed values * @param {object} [attrs.encoding='utf8'] Character encoding * @returns {object} Parsed response * @see https://github.com/sindresorhus/got/blob/main/documentation/2-options.md @@ -63,7 +69,8 @@ class BaseYamlService extends BaseService { schema, url, options = {}, - errorMessages = {}, + httpErrors = {}, + systemErrors = {}, encoding = 'utf8', }) { const logTrace = (...args) => trace.logTrace('fetch', ...args) @@ -79,7 +86,8 @@ class BaseYamlService extends BaseService { const { buffer } = await this._request({ url, options: mergedOptions, - errorMessages, + httpErrors, + systemErrors, }) let parsed try { @@ -115,7 +123,7 @@ export default BaseYamlService
diff --git a/core_base-service_base.js.html b/core_base-service_base.js.html index 342036cb6b..0bb4c8b964 100644 --- a/core_base-service_base.js.html +++ b/core_base-service_base.js.html @@ -254,7 +254,7 @@ class BaseService { this._metricHelper = metricHelper } - async _request({ url, options = {}, errorMessages = {} }) { + async _request({ url, options = {}, httpErrors = {}, systemErrors = {} }) { const logTrace = (...args) => trace.logTrace('fetch', ...args) let logUrl = url const logOptions = Object.assign({}, options) @@ -274,10 +274,14 @@ class BaseService { 'Request', `${logUrl}\n${JSON.stringify(logOptions, null, 2)}` ) - const { res, buffer } = await this._requestFetcher(url, options) + const { res, buffer } = await this._requestFetcher( + url, + options, + systemErrors + ) await this._meterResponse(res, buffer) logTrace(emojic.dart, 'Response status code', res.statusCode) - return checkErrorResponse(errorMessages)({ buffer, res }) + return checkErrorResponse(httpErrors)({ buffer, res }) } static enabledMetrics = [] @@ -356,11 +360,15 @@ class BaseService { error instanceof Deprecated ) { trace.logTrace('outbound', emojic.noGoodWoman, 'Handled error', error) - return { + const serviceData = { isError: true, message: error.prettyMessage, color: 'lightgray', } + if (error.cacheSeconds !== undefined) { + serviceData.cacheSeconds = error.cacheSeconds + } + return serviceData } else if (this._handleInternalErrors) { if ( !trace.logTrace( @@ -634,7 +642,7 @@ export default BaseService
diff --git a/core_base-service_errors.js.html b/core_base-service_errors.js.html index 4fed286141..57191e81d3 100644 --- a/core_base-service_errors.js.html +++ b/core_base-service_errors.js.html @@ -70,6 +70,7 @@ class ShieldsRuntimeError extends Error { if (props.underlyingError) { this.stack = props.underlyingError.stack } + this.cacheSeconds = props.cacheSeconds } } @@ -234,6 +235,9 @@ class Deprecated extends ShieldsRuntimeError { * @property {string} prettyMessage User-facing error message to override the * value of `defaultPrettyMessage()`. This is the text that will appear on the * badge when we catch and render the exception (Optional) + * @property {number} cacheSeconds Length of time to cache this error response + * for. Defaults to the cacheLength of the service class throwing the error + * (Optional) */ export { @@ -261,7 +265,7 @@ export {
diff --git a/core_base-service_graphql.js.html b/core_base-service_graphql.js.html index 0589c5dae9..79a1fc8d3f 100644 --- a/core_base-service_graphql.js.html +++ b/core_base-service_graphql.js.html @@ -93,7 +93,7 @@ export { mergeQueries }
diff --git a/core_base-service_resource-cache.js.html b/core_base-service_resource-cache.js.html index e0479053d2..0faacac89c 100644 --- a/core_base-service_resource-cache.js.html +++ b/core_base-service_resource-cache.js.html @@ -111,7 +111,7 @@ export { getCachedResource, clearResourceCache }
diff --git a/core_server_prometheus-metrics.js.html b/core_server_prometheus-metrics.js.html index e33b917321..af58acf9fd 100644 --- a/core_server_prometheus-metrics.js.html +++ b/core_server_prometheus-metrics.js.html @@ -127,7 +127,7 @@ export default class PrometheusMetrics {
diff --git a/core_server_server.js.html b/core_server_server.js.html index cb64f076bc..84fee69c8a 100644 --- a/core_server_server.js.html +++ b/core_server_server.js.html @@ -636,7 +636,7 @@ export default Server
diff --git a/core_service-test-runner_create-service-tester.js.html b/core_service-test-runner_create-service-tester.js.html index 00cdbd8a4e..ea6e849efa 100644 --- a/core_service-test-runner_create-service-tester.js.html +++ b/core_service-test-runner_create-service-tester.js.html @@ -74,7 +74,7 @@ export default createServiceTester
diff --git a/core_service-test-runner_icedfrisby-shields.js.html b/core_service-test-runner_icedfrisby-shields.js.html index 30e463a95d..cb9d4ca7c0 100644 --- a/core_service-test-runner_icedfrisby-shields.js.html +++ b/core_service-test-runner_icedfrisby-shields.js.html @@ -146,7 +146,7 @@ export default factory
diff --git a/core_service-test-runner_runner.js.html b/core_service-test-runner_runner.js.html index 16852656be..812d983618 100644 --- a/core_service-test-runner_runner.js.html +++ b/core_service-test-runner_runner.js.html @@ -118,7 +118,7 @@ export default Runner
diff --git a/core_service-test-runner_service-tester.js.html b/core_service-test-runner_service-tester.js.html index d0da91ff4b..4353b9bc8c 100644 --- a/core_service-test-runner_service-tester.js.html +++ b/core_service-test-runner_service-tester.js.html @@ -184,7 +184,7 @@ export default ServiceTester
diff --git a/core_service-test-runner_services-for-title.js.html b/core_service-test-runner_services-for-title.js.html index 86a792f5e9..59606006c7 100644 --- a/core_service-test-runner_services-for-title.js.html +++ b/core_service-test-runner_services-for-title.js.html @@ -75,7 +75,7 @@ export default servicesForTitle
diff --git a/core_token-pooling_token-pool.js.html b/core_token-pooling_token-pool.js.html index 95cc131699..245930daa0 100644 --- a/core_token-pooling_token-pool.js.html +++ b/core_token-pooling_token-pool.js.html @@ -379,7 +379,7 @@ export { sanitizeToken, Token, TokenPool }
diff --git a/global.html b/global.html index 15b2e12df1..2c0d066956 100644 --- a/global.html +++ b/global.html @@ -684,7 +684,7 @@
diff --git a/index.html b/index.html index e44c0053e3..7076a22b15 100644 --- a/index.html +++ b/index.html @@ -220,7 +220,7 @@ under their terms and license.


diff --git a/module-badge-maker.html b/module-badge-maker.html index 5b3a4114c6..2d80079217 100644 --- a/module-badge-maker.html +++ b/module-badge-maker.html @@ -429,7 +429,7 @@
diff --git a/module-badge-maker_lib_xml-ElementList.html b/module-badge-maker_lib_xml-ElementList.html index 9c5afe4d6f..c611457983 100644 --- a/module-badge-maker_lib_xml-ElementList.html +++ b/module-badge-maker_lib_xml-ElementList.html @@ -163,7 +163,7 @@ like an XmlElement but renders multiple XML tags (not wrapped in a ).

diff --git a/module-badge-maker_lib_xml-XmlElement.html b/module-badge-maker_lib_xml-XmlElement.html index 959cbcd86a..8d737caf81 100644 --- a/module-badge-maker_lib_xml-XmlElement.html +++ b/module-badge-maker_lib_xml-XmlElement.html @@ -474,7 +474,7 @@ element will be rendered as a self-closing element.


diff --git a/module-badge-maker_lib_xml.html b/module-badge-maker_lib_xml.html index d2457dd2ea..51a847521d 100644 --- a/module-badge-maker_lib_xml.html +++ b/module-badge-maker_lib_xml.html @@ -128,7 +128,7 @@
diff --git a/module-core_base-service_base-BaseService.html b/module-core_base-service_base-BaseService.html index 8e225d1a21..eefbc110fb 100644 --- a/module-core_base-service_base-BaseService.html +++ b/module-core_base-service_base-BaseService.html @@ -741,7 +741,7 @@ defined in this.route.pattern or this.route.capture

Source:
@@ -815,7 +815,7 @@ defined in this.route.pattern or this.route.capture


diff --git a/module-core_base-service_base-graphql-BaseGraphqlService.html b/module-core_base-service_base-graphql-BaseGraphqlService.html index 25a215413b..e3134ef446 100644 --- a/module-core_base-service_base-graphql-BaseGraphqlService.html +++ b/module-core_base-service_base-graphql-BaseGraphqlService.html @@ -622,6 +622,50 @@ This can be used to extend or override the + + + systemErrors + + + + + +object + + + + + + + + + <optional>
+ + + + + + + + + + + + {} + + + + +

Key-value map of got network exception codes +and an object of params to pass when we construct an Inaccessible exception object +e.g: { ECONNRESET: { prettyMessage: 'connection reset' } }. +See got error codes +for allowed keys +and module:core/base-service/errors~RuntimeErrorProps for allowed values

+ + + + transformJson @@ -748,7 +792,7 @@ an InvalidResponse.

Source:
@@ -829,7 +873,7 @@ an InvalidResponse.


diff --git a/module-core_base-service_base-graphql.html b/module-core_base-service_base-graphql.html index 2f0485e771..26e9bbd27e 100644 --- a/module-core_base-service_base-graphql.html +++ b/module-core_base-service_base-graphql.html @@ -125,7 +125,7 @@
diff --git a/module-core_base-service_base-json-BaseJsonService.html b/module-core_base-service_base-json-BaseJsonService.html index 11788a666d..903b5618a9 100644 --- a/module-core_base-service_base-json-BaseJsonService.html +++ b/module-core_base-service_base-json-BaseJsonService.html @@ -510,7 +510,7 @@ parse it and validate against a schema

- errorMessages + httpErrors @@ -549,6 +549,50 @@ This can be used to extend or override the + + + + systemErrors + + + + + +object + + + + + + + + + <optional>
+ + + + + + + + + + + + {} + + + + +

Key-value map of got network exception codes +and an object of params to pass when we construct an Inaccessible exception object +e.g: { ECONNRESET: { prettyMessage: 'connection reset' } }. +See got error codes +for allowed keys +and module:core/base-service/errors~RuntimeErrorProps for allowed values

+ + + @@ -593,7 +637,7 @@ This can be used to extend or override the
Source:
@@ -674,7 +718,7 @@ This can be used to extend or override the
diff --git a/module-core_base-service_base-json.html b/module-core_base-service_base-json.html index b7c77aa38c..68d92ebe20 100644 --- a/module-core_base-service_base-json.html +++ b/module-core_base-service_base-json.html @@ -125,7 +125,7 @@
diff --git a/module-core_base-service_base-svg-scraping-BaseSvgScrapingService.html b/module-core_base-service_base-svg-scraping-BaseSvgScrapingService.html index 2bc62ed4e2..bda71402f6 100644 --- a/module-core_base-service_base-svg-scraping-BaseSvgScrapingService.html +++ b/module-core_base-service_base-svg-scraping-BaseSvgScrapingService.html @@ -387,7 +387,7 @@ parse a value from it and validate against a schema

- errorMessages + httpErrors @@ -426,6 +426,50 @@ This can be used to extend or override the + + + + systemErrors + + + + + +object + + + + + + + + + <optional>
+ + + + + + + + + + + + {} + + + + +

Key-value map of got network exception codes +and an object of params to pass when we construct an Inaccessible exception object +e.g: { ECONNRESET: { prettyMessage: 'connection reset' } }. +See got error codes +for allowed keys +and module:core/base-service/errors~RuntimeErrorProps for allowed values

+ + + @@ -470,7 +514,7 @@ This can be used to extend or override the
Source:
@@ -765,7 +809,7 @@ This can be used to extend or override the
diff --git a/module-core_base-service_base-svg-scraping.html b/module-core_base-service_base-svg-scraping.html index 2c6fc59c5c..07f194bd88 100644 --- a/module-core_base-service_base-svg-scraping.html +++ b/module-core_base-service_base-svg-scraping.html @@ -125,7 +125,7 @@
diff --git a/module-core_base-service_base-xml-BaseXmlService.html b/module-core_base-service_base-xml-BaseXmlService.html index 8112b565ef..2b462188c9 100644 --- a/module-core_base-service_base-xml-BaseXmlService.html +++ b/module-core_base-service_base-xml-BaseXmlService.html @@ -351,7 +351,7 @@ parse it and validate against a schema

- errorMessages + httpErrors @@ -391,6 +391,50 @@ This can be used to extend or override the + + + systemErrors + + + + + +object + + + + + + + + + <optional>
+ + + + + + + + + + + + {} + + + + +

Key-value map of got network exception codes +and an object of params to pass when we construct an Inaccessible exception object +e.g: { ECONNRESET: { prettyMessage: 'connection reset' } }. +See got error codes +for allowed keys +and module:core/base-service/errors~RuntimeErrorProps for allowed values

+ + + + parserOptions @@ -474,7 +518,7 @@ This can be used to extend or override the
Source:
@@ -557,7 +601,7 @@ This can be used to extend or override the
diff --git a/module-core_base-service_base-xml.html b/module-core_base-service_base-xml.html index 7f26004351..5dadf1adcc 100644 --- a/module-core_base-service_base-xml.html +++ b/module-core_base-service_base-xml.html @@ -125,7 +125,7 @@
diff --git a/module-core_base-service_base-yaml-BaseYamlService.html b/module-core_base-service_base-yaml-BaseYamlService.html index e75fe43cfb..550d72c1d8 100644 --- a/module-core_base-service_base-yaml-BaseYamlService.html +++ b/module-core_base-service_base-yaml-BaseYamlService.html @@ -351,7 +351,7 @@ parse it and validate against a schema

- errorMessages + httpErrors @@ -391,6 +391,50 @@ This can be used to extend or override the + + + systemErrors + + + + + +object + + + + + + + + + <optional>
+ + + + + + + + + + + + {} + + + + +

Key-value map of got network exception codes +and an object of params to pass when we construct an Inaccessible exception object +e.g: { ECONNRESET: { prettyMessage: 'connection reset' } }. +See got error codes +for allowed keys +and module:core/base-service/errors~RuntimeErrorProps for allowed values

+ + + + encoding @@ -473,7 +517,7 @@ This can be used to extend or override the
Source:
@@ -554,7 +598,7 @@ This can be used to extend or override the
diff --git a/module-core_base-service_base-yaml.html b/module-core_base-service_base-yaml.html index b78b7f5cc5..39a94b4f9c 100644 --- a/module-core_base-service_base-yaml.html +++ b/module-core_base-service_base-yaml.html @@ -125,7 +125,7 @@
diff --git a/module-core_base-service_base.html b/module-core_base-service_base.html index 9eea96249a..e53f787a8a 100644 --- a/module-core_base-service_base.html +++ b/module-core_base-service_base.html @@ -261,7 +261,7 @@ configured credentials are present.

Source:
@@ -480,7 +480,7 @@ configured credentials are present.

Source:
@@ -673,7 +673,7 @@ configured credentials are present.

Source:
@@ -939,7 +939,7 @@ users locate relevant badges.

Source:
@@ -1172,7 +1172,7 @@ when the parameter is absent. (Note that in,
Source:
@@ -1208,7 +1208,7 @@ when the parameter is absent. (Note that in,
diff --git a/module-core_base-service_errors-Deprecated.html b/module-core_base-service_errors-Deprecated.html index 40d2b416f8..6dbc5060eb 100644 --- a/module-core_base-service_errors-Deprecated.html +++ b/module-core_base-service_errors-Deprecated.html @@ -143,7 +143,7 @@
Source:
@@ -211,7 +211,7 @@
diff --git a/module-core_base-service_errors-ImproperlyConfigured.html b/module-core_base-service_errors-ImproperlyConfigured.html index d2dff79809..85598703bd 100644 --- a/module-core_base-service_errors-ImproperlyConfigured.html +++ b/module-core_base-service_errors-ImproperlyConfigured.html @@ -143,7 +143,7 @@
Source:
@@ -211,7 +211,7 @@
diff --git a/module-core_base-service_errors-Inaccessible.html b/module-core_base-service_errors-Inaccessible.html index 75cd61c267..f0ba7dddec 100644 --- a/module-core_base-service_errors-Inaccessible.html +++ b/module-core_base-service_errors-Inaccessible.html @@ -144,7 +144,7 @@ or to wrap a 5XX response

Source:
@@ -212,7 +212,7 @@ or to wrap a 5XX response


diff --git a/module-core_base-service_errors-InvalidParameter.html b/module-core_base-service_errors-InvalidParameter.html index f7e2f3bd7c..4c89191890 100644 --- a/module-core_base-service_errors-InvalidParameter.html +++ b/module-core_base-service_errors-InvalidParameter.html @@ -144,7 +144,7 @@ is invalid or unexpected

Source:
@@ -212,7 +212,7 @@ is invalid or unexpected


diff --git a/module-core_base-service_errors-InvalidResponse.html b/module-core_base-service_errors-InvalidResponse.html index 41075fee38..e3b9f419c3 100644 --- a/module-core_base-service_errors-InvalidResponse.html +++ b/module-core_base-service_errors-InvalidResponse.html @@ -143,7 +143,7 @@
Source:
@@ -211,7 +211,7 @@
diff --git a/module-core_base-service_errors-NotFound.html b/module-core_base-service_errors-NotFound.html index 0719f3b9ff..f95403fd6c 100644 --- a/module-core_base-service_errors-NotFound.html +++ b/module-core_base-service_errors-NotFound.html @@ -143,7 +143,7 @@
Source:
@@ -211,7 +211,7 @@
diff --git a/module-core_base-service_errors-ShieldsRuntimeError.html b/module-core_base-service_errors-ShieldsRuntimeError.html index bdb05addb3..76a62a3f95 100644 --- a/module-core_base-service_errors-ShieldsRuntimeError.html +++ b/module-core_base-service_errors-ShieldsRuntimeError.html @@ -384,7 +384,7 @@ should override this method.


diff --git a/module-core_base-service_errors.html b/module-core_base-service_errors.html index 5f7fc391dd..fb3eab23dd 100644 --- a/module-core_base-service_errors.html +++ b/module-core_base-service_errors.html @@ -247,6 +247,31 @@ badge when we catch and render the exception (Optional)

+ + + + cacheSeconds + + + + + +number + + + + + + + + + +

Length of time to cache this error response +for. Defaults to the cacheLength of the service class throwing the error +(Optional)

+ + + @@ -282,7 +307,7 @@ badge when we catch and render the exception (Optional)

Source:
@@ -318,7 +343,7 @@ badge when we catch and render the exception (Optional)


diff --git a/module-core_base-service_graphql.html b/module-core_base-service_graphql.html index 205e2d264f..745eb41f8d 100644 --- a/module-core_base-service_graphql.html +++ b/module-core_base-service_graphql.html @@ -296,7 +296,7 @@ but can't use that due to incorrect packaging.


diff --git a/module-core_base-service_resource-cache.html b/module-core_base-service_resource-cache.html index 5f17bcddf2..58d4fbcadd 100644 --- a/module-core_base-service_resource-cache.html +++ b/module-core_base-service_resource-cache.html @@ -568,7 +568,7 @@
diff --git a/module-core_server_server-Server.html b/module-core_server_server-Server.html index e4a188db18..51d995f96f 100644 --- a/module-core_server_server-Server.html +++ b/module-core_server_server-Server.html @@ -681,7 +681,7 @@ Start listening for requests on this.baseUrl()


diff --git a/module-core_server_server.html b/module-core_server_server.html index 6664fec27e..728fb01c11 100644 --- a/module-core_server_server.html +++ b/module-core_server_server.html @@ -125,7 +125,7 @@
diff --git a/module-core_service-test-runner_create-service-tester.html b/module-core_service-test-runner_create-service-tester.html index 450d5380a6..acfe509998 100644 --- a/module-core_service-test-runner_create-service-tester.html +++ b/module-core_service-test-runner_create-service-tester.html @@ -236,7 +236,7 @@ service.


diff --git a/module-core_service-test-runner_icedfrisby-shields.html b/module-core_service-test-runner_icedfrisby-shields.html index 141af3fd9c..51dfabc6fa 100644 --- a/module-core_service-test-runner_icedfrisby-shields.html +++ b/module-core_service-test-runner_icedfrisby-shields.html @@ -292,7 +292,7 @@
diff --git a/module-core_service-test-runner_runner-Runner.html b/module-core_service-test-runner_runner-Runner.html index bcd1264637..7934c6c37b 100644 --- a/module-core_service-test-runner_runner-Runner.html +++ b/module-core_service-test-runner_runner-Runner.html @@ -568,7 +568,7 @@ overridden on instances.


diff --git a/module-core_service-test-runner_runner.html b/module-core_service-test-runner_runner.html index 247bba3d47..dd0931b3e0 100644 --- a/module-core_service-test-runner_runner.html +++ b/module-core_service-test-runner_runner.html @@ -125,7 +125,7 @@
diff --git a/module-core_service-test-runner_service-tester-ServiceTester.html b/module-core_service-test-runner_service-tester-ServiceTester.html index 32140ae3d8..45be9afb59 100644 --- a/module-core_service-test-runner_service-tester-ServiceTester.html +++ b/module-core_service-test-runner_service-tester-ServiceTester.html @@ -1126,7 +1126,7 @@ the CLI, or directly on the tester.


diff --git a/module-core_service-test-runner_service-tester.html b/module-core_service-test-runner_service-tester.html index d47ed460f9..e861100ec0 100644 --- a/module-core_service-test-runner_service-tester.html +++ b/module-core_service-test-runner_service-tester.html @@ -125,7 +125,7 @@
diff --git a/module-core_service-test-runner_services-for-title.html b/module-core_service-test-runner_services-for-title.html index ec0fd6cce0..da22dbb1cb 100644 --- a/module-core_service-test-runner_services-for-title.html +++ b/module-core_service-test-runner_services-for-title.html @@ -284,7 +284,7 @@ as an array of strings.


diff --git a/module-core_token-pooling_token-pool-Token.html b/module-core_token-pooling_token-pool-Token.html index 54b9e0728b..558687b84b 100644 --- a/module-core_token-pooling_token-pool-Token.html +++ b/module-core_token-pooling_token-pool-Token.html @@ -715,7 +715,7 @@ stable ordering for a valid priority queue.


diff --git a/module-core_token-pooling_token-pool-TokenPool.html b/module-core_token-pooling_token-pool-TokenPool.html index 5464029001..b4e8ad21cf 100644 --- a/module-core_token-pooling_token-pool-TokenPool.html +++ b/module-core_token-pooling_token-pool-TokenPool.html @@ -899,7 +899,7 @@ indicate it should not be reused.


diff --git a/module-core_token-pooling_token-pool.html b/module-core_token-pooling_token-pool.html index 9d52de14bd..83dbfa57de 100644 --- a/module-core_token-pooling_token-pool.html +++ b/module-core_token-pooling_token-pool.html @@ -291,7 +291,7 @@
diff --git a/module-services_build-status.html b/module-services_build-status.html index a629eebbaf..7f4419c220 100644 --- a/module-services_build-status.html +++ b/module-services_build-status.html @@ -453,7 +453,7 @@ Determines the message and color of the badge according to the build status.


diff --git a/module-services_color-formatters.html b/module-services_color-formatters.html index 641985d8f5..58afd2e801 100644 --- a/module-services_color-formatters.html +++ b/module-services_color-formatters.html @@ -1532,7 +1532,7 @@ The color defaults to red if the score does not matches with any of the grade va
diff --git a/module-services_contributor-count.html b/module-services_contributor-count.html index 23528f70e9..1f15f849bc 100644 --- a/module-services_contributor-count.html +++ b/module-services_contributor-count.html @@ -536,7 +536,7 @@ Determines the message and color of the badge according to the contributor count
diff --git a/module-services_downloads.html b/module-services_downloads.html index 8b73a27d19..3065ef988f 100644 --- a/module-services_downloads.html +++ b/module-services_downloads.html @@ -546,7 +546,7 @@ this value as the prefix for versioned badges, e.g. foobar@v1.23. D
diff --git a/module-services_dynamic-common.html b/module-services_dynamic-common.html index c9fd25ba23..26c721a26b 100644 --- a/module-services_dynamic-common.html +++ b/module-services_dynamic-common.html @@ -175,7 +175,7 @@ Checks if the compound value is of type individualValueSchema, array of individu -

(inner, constant) errorMessages :object

+

(inner, constant) httpErrors :object

@@ -960,7 +960,7 @@ Sets the color of the badge to blue.


diff --git a/module-services_dynamic_json-path.html b/module-services_dynamic_json-path.html index b4df69db98..d06ff34be0 100644 --- a/module-services_dynamic_json-path.html +++ b/module-services_dynamic_json-path.html @@ -266,7 +266,7 @@ - errorMessages + httpErrors @@ -423,7 +423,7 @@ This can be used to extend or override the
diff --git a/module-services_endpoint-common.html b/module-services_endpoint-common.html index bdc0743bfb..16264342b1 100644 --- a/module-services_endpoint-common.html +++ b/module-services_endpoint-common.html @@ -316,7 +316,7 @@ - errorMessages + httpErrors @@ -810,7 +810,7 @@ Optionally it prints those keys in the message to provide detailed feedback.


diff --git a/module-services_licenses.html b/module-services_licenses.html index 9a3dbb4f01..1a63ce8540 100644 --- a/module-services_licenses.html +++ b/module-services_licenses.html @@ -650,7 +650,7 @@ Sets the badge color to the provided value, if not provided then the color is us
diff --git a/module-services_package-json-helpers.html b/module-services_package-json-helpers.html index 71ddf799da..58234e41ac 100644 --- a/module-services_package-json-helpers.html +++ b/module-services_package-json-helpers.html @@ -656,7 +656,7 @@ Checks if the object has all the dependency types and the dependency types are v
diff --git a/module-services_php-version.html b/module-services_php-version.html index 1236c726a4..289f450bc5 100644 --- a/module-services_php-version.html +++ b/module-services_php-version.html @@ -1472,7 +1472,7 @@ Return { numbers: [1,0,something big], modifier: 2, modifierCount: 1 }


diff --git a/module-services_pipenv-helpers.html b/module-services_pipenv-helpers.html index c184174cdb..8d6e6d8d56 100644 --- a/module-services_pipenv-helpers.html +++ b/module-services_pipenv-helpers.html @@ -616,7 +616,7 @@ Checks if the lock file object has required properties and the properties are va
diff --git a/module-services_route-builder.html b/module-services_route-builder.html index fdc8889bfd..efb3cffc39 100644 --- a/module-services_route-builder.html +++ b/module-services_route-builder.html @@ -621,7 +621,7 @@
diff --git a/module-services_steam_steam-base-BaseSteamAPI.html b/module-services_steam_steam-base-BaseSteamAPI.html index 8129db4c7d..3382542ed4 100644 --- a/module-services_steam_steam-base-BaseSteamAPI.html +++ b/module-services_steam_steam-base-BaseSteamAPI.html @@ -380,7 +380,7 @@
diff --git a/module-services_steam_steam-base.html b/module-services_steam_steam-base.html index fe730f49c7..f43e48a216 100644 --- a/module-services_steam_steam-base.html +++ b/module-services_steam_steam-base.html @@ -125,7 +125,7 @@
diff --git a/module-services_text-formatters.html b/module-services_text-formatters.html index ba1ac00432..0cab22ed1b 100644 --- a/module-services_text-formatters.html +++ b/module-services_text-formatters.html @@ -1680,7 +1680,7 @@ The remaining stars are empty stars until the maximum number of stars is reached
diff --git a/module-services_validators.html b/module-services_validators.html index 6251aeed97..5a13ebcd8c 100644 --- a/module-services_validators.html +++ b/module-services_validators.html @@ -707,7 +707,7 @@ Some invalid values for this validator are: abc, 1.a, 1.0-, .1


diff --git a/services_build-status.js.html b/services_build-status.js.html index 18ef569290..94c7bf7218 100644 --- a/services_build-status.js.html +++ b/services_build-status.js.html @@ -140,7 +140,7 @@ export { isBuildStatus, renderBuildStatusBadge }
diff --git a/services_color-formatters.js.html b/services_color-formatters.js.html index bb9013fb0e..7384b78044 100644 --- a/services_color-formatters.js.html +++ b/services_color-formatters.js.html @@ -240,7 +240,7 @@ export {
diff --git a/services_contributor-count.js.html b/services_contributor-count.js.html index d2933dcb4d..d6c1bc6301 100644 --- a/services_contributor-count.js.html +++ b/services_contributor-count.js.html @@ -85,7 +85,7 @@ export { contributorColor, renderContributorBadge }
diff --git a/services_downloads.js.html b/services_downloads.js.html index a7e7195839..5d1ba6a7c4 100644 --- a/services_downloads.js.html +++ b/services_downloads.js.html @@ -101,7 +101,7 @@ export { renderDownloadsBadge }
diff --git a/services_dynamic-common.js.html b/services_dynamic-common.js.html index 8b2136815c..1290274d93 100644 --- a/services_dynamic-common.js.html +++ b/services_dynamic-common.js.html @@ -42,7 +42,7 @@ import { InvalidResponse } from './index.js' * * @type {object} */ -const errorMessages = { +const httpErrors = { 404: 'resource not found', } @@ -121,7 +121,7 @@ function renderDynamicBadge({ } export { - errorMessages, + httpErrors, individualValueSchema, transformAndValidate, renderDynamicBadge, @@ -142,7 +142,7 @@ export {
diff --git a/services_dynamic_json-path.js.html b/services_dynamic_json-path.js.html index 63afa25a75..6cb6fbd3f6 100644 --- a/services_dynamic_json-path.js.html +++ b/services_dynamic_json-path.js.html @@ -32,7 +32,7 @@ import Joi from 'joi' import jp from 'jsonpath' -import { renderDynamicBadge, errorMessages } from '../dynamic-common.js' +import { renderDynamicBadge, httpErrors } from '../dynamic-common.js' import { InvalidParameter, InvalidResponse } from '../index.js' /** @@ -52,13 +52,13 @@ export default superclass => * @param {object} attrs Refer to individual attrs * @param {Joi} attrs.schema Joi schema to validate the response transformed to JSON * @param {string} attrs.url URL to request - * @param {object} [attrs.errorMessages={}] Key-value map of status codes + * @param {object} [attrs.httpErrors={}] Key-value map of status codes * and custom error messages e.g: `{ 404: 'package not found' }`. * This can be used to extend or override the * [default](https://github.com/badges/shields/blob/master/services/dynamic-common.js#L8) * @returns {object} Parsed response */ - async fetch({ schema, url, errorMessages }) { + async fetch({ schema, url, httpErrors }) { throw new Error( `fetch() function not implemented for ${this.constructor.name}` ) @@ -68,7 +68,7 @@ export default superclass => const data = await this.fetch({ schema: Joi.any(), url, - errorMessages, + httpErrors, }) // JSONPath only works on objects and arrays. @@ -120,7 +120,7 @@ export default superclass =>
diff --git a/services_endpoint-common.js.html b/services_endpoint-common.js.html index b21614d6a5..ca555221f7 100644 --- a/services_endpoint-common.js.html +++ b/services_endpoint-common.js.html @@ -110,19 +110,19 @@ const anySchema = Joi.any() * @param {object} serviceInstance Instance of Endpoint class * @param {object} attrs Refer to individual attributes * @param {string} attrs.url Endpoint URL - * @param {object} attrs.errorMessages Object containing error messages for different error codes + * @param {object} attrs.httpErrors Object containing error messages for different error codes * @param {string} attrs.validationPrettyErrorMessage If provided then the error message is set to this value * @param {boolean} attrs.includeKeys If true then includes error details in error message * @returns {object} Data fetched from endpoint */ async function fetchEndpointData( serviceInstance, - { url, errorMessages, validationPrettyErrorMessage, includeKeys } + { url, httpErrors, validationPrettyErrorMessage, includeKeys } ) { const json = await serviceInstance._requestJson({ schema: anySchema, url, - errorMessages, + httpErrors, options: { decompress: true }, }) return validateEndpointData(json, { @@ -148,7 +148,7 @@ export { validateEndpointData, fetchEndpointData }
diff --git a/services_licenses.js.html b/services_licenses.js.html index ca3dbfa600..a084063b0b 100644 --- a/services_licenses.js.html +++ b/services_licenses.js.html @@ -201,7 +201,7 @@ export { licenseToColor, renderLicenseBadge }
diff --git a/services_package-json-helpers.js.html b/services_package-json-helpers.js.html index f2977b9c0f..76111b8115 100644 --- a/services_package-json-helpers.js.html +++ b/services_package-json-helpers.js.html @@ -120,7 +120,7 @@ export { isDependencyMap, isPackageJsonWithDependencies, getDependencyVersion }
diff --git a/services_packagist_packagist-base.js.html b/services_packagist_packagist-base.js.html index e3c8b59407..4b31ab089b 100644 --- a/services_packagist_packagist-base.js.html +++ b/services_packagist_packagist-base.js.html @@ -227,7 +227,7 @@ export {
diff --git a/services_php-version.js.html b/services_php-version.js.html index cefa13af87..3a3815baca 100644 --- a/services_php-version.js.html +++ b/services_php-version.js.html @@ -341,7 +341,7 @@ export {
diff --git a/services_pipenv-helpers.js.html b/services_pipenv-helpers.js.html index 3daad76484..56dd2057ec 100644 --- a/services_pipenv-helpers.js.html +++ b/services_pipenv-helpers.js.html @@ -128,7 +128,7 @@ export { isLockfile, getDependencyVersion }
diff --git a/services_route-builder.js.html b/services_route-builder.js.html index eb8110fdb2..930605b776 100644 --- a/services_route-builder.js.html +++ b/services_route-builder.js.html @@ -105,7 +105,7 @@ export default class RouteBuilder {
diff --git a/services_steam_steam-base.js.html b/services_steam_steam-base.js.html index 286dbefc0a..d9c17c7cb2 100644 --- a/services_steam_steam-base.js.html +++ b/services_steam_steam-base.js.html @@ -73,7 +73,7 @@ class BaseSteamAPI extends BaseJsonService { return this._requestJson({ url, schema, - errorMessages: { + httpErrors: { 400: 'bad request', }, options, @@ -98,7 +98,7 @@ export default BaseSteamAPI
diff --git a/services_test-validators.js.html b/services_test-validators.js.html index b0c4835f1a..52448dc728 100644 --- a/services_test-validators.js.html +++ b/services_test-validators.js.html @@ -259,7 +259,7 @@ export {
diff --git a/services_text-formatters.js.html b/services_text-formatters.js.html index 249c631d73..fe3f4651ed 100644 --- a/services_text-formatters.js.html +++ b/services_text-formatters.js.html @@ -252,7 +252,7 @@ export {
diff --git a/services_validators.js.html b/services_validators.js.html index 3546649d52..f228a2af74 100644 --- a/services_validators.js.html +++ b/services_validators.js.html @@ -123,7 +123,7 @@ export const fileSize = Joi.string()
diff --git a/tutorial-TUTORIAL.html b/tutorial-TUTORIAL.html index da3d6bf671..86cbd17f85 100644 --- a/tutorial-TUTORIAL.html +++ b/tutorial-TUTORIAL.html @@ -261,12 +261,12 @@ export default class GemVersion extends BaseJsonService {