@platformatic/metaconfig
Advanced tools
Comparing version 0.45.1 to 0.46.0
@@ -10,2 +10,3 @@ 'use strict' | ||
const FromZeroEighteenToWillSee = require('./versions/from-zero-eighteen-to-will-see.js') | ||
const errors = require('./errors.js') | ||
@@ -27,7 +28,7 @@ const ranges = [{ | ||
} else { | ||
throw new Error('missing file or config to analyze') | ||
throw new errors.MissingFileOrConfigError() | ||
} | ||
if (!data.$schema) { | ||
throw new Error('missing $schema, unable to determine the version') | ||
throw new errors.MissingSchemaError() | ||
} | ||
@@ -47,3 +48,3 @@ | ||
if (!res) { | ||
throw new Error('unable to determine the version') | ||
throw new errors.UnableToDetermineVersionError() | ||
} | ||
@@ -83,3 +84,3 @@ | ||
if (!Handler) { | ||
throw new Error('unable to determine the version') | ||
throw new errors.UnableToDetermineVersionError() | ||
} | ||
@@ -106,3 +107,3 @@ } | ||
default: | ||
throw new Error('Invalid config file extension. Only yml, yaml, json, json5, toml, tml are supported.') | ||
throw new errors.InvalidConfigFileExtensionError() | ||
} | ||
@@ -126,3 +127,3 @@ } | ||
default: | ||
throw new Error('Invalid config file extension. Only yml, yaml, json, json5, toml, tml are supported.') | ||
throw new errors.InvalidConfigFileExtensionError() | ||
} | ||
@@ -149,1 +150,2 @@ } | ||
module.exports.upgrade = upgrade | ||
module.exports.errors = errors |
{ | ||
"name": "@platformatic/metaconfig", | ||
"version": "0.45.1", | ||
"version": "0.46.0", | ||
"main": "metaconfig.js", | ||
@@ -22,2 +22,3 @@ "description": "Manage mulitple configuration versions at the same time", | ||
"dependencies": { | ||
"@fastify/error": "^3.2.1", | ||
"@iarna/toml": "^2.2.5", | ||
@@ -24,0 +25,0 @@ "json5": "^2.2.3", |
@@ -14,2 +14,3 @@ 'use strict' | ||
const semver = require('semver') | ||
const createError = require('@fastify/error') | ||
@@ -63,7 +64,9 @@ test('throws if no config or file is provided', async (t) => { | ||
test('throws if the stringifier is unknown', async (t) => { | ||
t.throws(() => { getStringifier('file.foo') }, new Error('Invalid config file extension. Only yml, yaml, json, json5, toml, tml are supported.')) | ||
const expectedError = new (createError('PLT_SQL_METACONFIG_INVALID_CONFIG_FILE_EXTENSION', 'Invalid config file extension. Only yml, yaml, json, json5, toml, tml are supported.'))() | ||
t.throws(() => { getStringifier('file.foo') }, expectedError) | ||
}) | ||
test('throws if the parser is unknown', async (t) => { | ||
t.throws(() => { getParser('file.foo') }, new Error('Invalid config file extension. Only yml, yaml, json, json5, toml, tml are supported.')) | ||
const expectedError = new (createError('PLT_SQL_METACONFIG_INVALID_CONFIG_FILE_EXTENSION', 'Invalid config file extension. Only yml, yaml, json, json5, toml, tml are supported.'))() | ||
t.throws(() => { getParser('file.foo') }, expectedError) | ||
}) | ||
@@ -70,0 +73,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
71140
37
1968
6
+ Added@fastify/error@^3.2.1
+ Added@fastify/error@3.4.1(transitive)