From e70eb4067a2d7a10a7d080382502c5332fc4f9e3 Mon Sep 17 00:00:00 2001 From: Santanu Roy Date: Wed, 20 Dec 2023 17:27:25 +0530 Subject: [PATCH] fix(error): addressed pr comments & error in test run Signed-off-by: Santanu Roy --- packages/concerto-core/api.txt | 3 +++ packages/concerto-core/changelog.txt | 3 ++- .../lib/introspect/stringvalidatorexception.js | 8 ++++---- packages/concerto-core/lib/introspect/validator.js | 4 ++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/packages/concerto-core/api.txt b/packages/concerto-core/api.txt index 709811362..672fbc168 100644 --- a/packages/concerto-core/api.txt +++ b/packages/concerto-core/api.txt @@ -280,6 +280,9 @@ class ScalarDeclaration extends Declaration { + boolean isEvent() + boolean isConcept() } +class StringValidatorException extends Error { + + void constructor(string,string) +} class TransactionDeclaration extends IdentifiedDeclaration { + void constructor(ModelFile,Object) throws IllegalModelException + string declarationKind() diff --git a/packages/concerto-core/changelog.txt b/packages/concerto-core/changelog.txt index c65e01c24..b9e6e5f06 100644 --- a/packages/concerto-core/changelog.txt +++ b/packages/concerto-core/changelog.txt @@ -24,8 +24,9 @@ # Note that the latest public API is documented using JSDocs and is available in api.txt. # -Version 3.13.3 {b286dfdeeb654d25be7c5f9cc6305e38} 2023-11-07 +Version 3.13.3 {1df986a8e13fe0d984069b9637c0a1c4} 2023-11-07 - Added DCS and vocabulary extraction support for decoratorManager +- Added StringValidatorException class to support error type Version 3.13.2 {dccc690753912cf87e7ceec56d949058} 2023-10-18 - Add getNamespace method to key type and value type of maps diff --git a/packages/concerto-core/lib/introspect/stringvalidatorexception.js b/packages/concerto-core/lib/introspect/stringvalidatorexception.js index aed3ec35e..e9c63c007 100644 --- a/packages/concerto-core/lib/introspect/stringvalidatorexception.js +++ b/packages/concerto-core/lib/introspect/stringvalidatorexception.js @@ -15,15 +15,15 @@ 'use strict'; /** -* Class representing an validation error related to anykind of string validatoin in introspect +* Class representing an validation error related to anykind of string validation in introspect * @class * @memberof module:concerto-core */ -class StringValidationException extends Error { +class StringValidatorException extends Error { /** * Create error related to string validation. * @param {string} errormessage - The exception message. - * @param {string} errorType - conditional parameter which denoted the kind of string + * @param {string} errorType - conditional parameter which denotes/represents the kind of string * error , defaults to StringValidationError if not provided */ constructor(errormessage,errorType) { @@ -34,5 +34,5 @@ class StringValidationException extends Error { } -module.exports = StringValidationException; +module.exports = StringValidatorException; diff --git a/packages/concerto-core/lib/introspect/validator.js b/packages/concerto-core/lib/introspect/validator.js index f6646472b..1f7ec3f6b 100644 --- a/packages/concerto-core/lib/introspect/validator.js +++ b/packages/concerto-core/lib/introspect/validator.js @@ -14,7 +14,7 @@ 'use strict'; -const StringValidationException = require('./stringvalidatorexception'); +const StringValidatorException = require('./stringvalidatorexception'); // Types needed for TypeScript generation. /* eslint-disable no-unused-vars */ @@ -52,7 +52,7 @@ class Validator { * @throws {Error} throws an error to report the message */ reportError(id, msg, errorType='ValidatorError') { - throw new StringValidationException('Validator error for field `' + id + '`. ' + this.getFieldOrScalarDeclaration().getFullyQualifiedName() + ': ' + msg ,errorType); + throw new StringValidatorException('Validator error for field `' + id + '`. ' + this.getFieldOrScalarDeclaration().getFullyQualifiedName() + ': ' + msg ,errorType); } /**