Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Comments

@santanu8961
Copy link
Contributor

Bug Report 🐛

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.js reportError 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant