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
Errors when creating validators in concerto introspect only return a string in a error message , which makes programatic handling the errors dificult
#772
Closed
santanu8961 opened this issue
Dec 15, 2023
· 0 comments
· Fixed by #773
While adding AST models to a ModelManager and validating a string if there is any error the error only consists of an error message because it gets challenging to detect what kind of error it is, and based on that doing any operation
Expected Behavior
The error structure should have a type to it which can tell the service consuming it what kind of error it is.
Current Behavior
right now in concerto/packages/concerto-core/lib/introspect/validator.jsreportError only reports an error message, not a type
Possible Solution
implementing a type with an error message altogether passing a proper error object can fix this behavior.
Steps to Reproduce
const modelManager = new ModelManager({ strict: true, regExp: RE2 });
const modelFiles = [m].map(item => new ModelFile(modelManager, item.metamodel));
modelFiles.sort((a, b) => a.getNamespace().localeCompare(b.getNamespace()));
modelManager.addModelFiles(modelFiles);
In this code block I am using a custom regex validator re2 which I am passing to ModelManager now if the metamodel has a regex validator that does not satisfy the compliance and throws an error its just a message with information but no type is there, so its difficult to classify which type of error is that and doing some operation like throwing a bad request error is difficult.
Context (Environment)
Desktop
OS: Windows with WSL
Browser: Chrome
Detailed Description
Possible Implementation
The text was updated successfully, but these errors were encountered:
Bug Report 🐛
While adding AST models to a
ModelManager
and validating astring
if there is any error the error only consists of an error message because it gets challenging to detect what kind of error it is, and based on that doing any operationExpected Behavior
The error structure should have a
type
to it which can tell the service consuming it what kind of error it is.Current Behavior
right now in
concerto/packages/concerto-core/lib/introspect/validator.js
reportError
only reports an error message, not a typePossible Solution
implementing a type with an error message altogether passing a proper error object can fix this behavior.
Steps to Reproduce
In this code block I am using a custom regex validator re2 which I am passing to
ModelManager
now if the metamodel has a regex validator that does not satisfy the compliance and throws an error its just a message with information but no type is there, so its difficult to classify which type of error is that and doing some operation like throwing a bad request error is difficult.Context (Environment)
Desktop
Detailed Description
Possible Implementation
The text was updated successfully, but these errors were encountered: