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

Added error codes to property validation errors #835

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions packages/concerto-core/lib/introspect/property.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const { MetaModelNamespace } = require('@accordproject/concerto-metamodel');

const ModelUtil = require('../modelutil');
const IllegalModelException = require('./illegalmodelexception');
const TypeNotFoundException = require("../../lib/typenotfoundexception");
const Decorated = require('./decorated');

// Types needed for TypeScript generation.
Expand Down Expand Up @@ -182,11 +183,11 @@ class Property extends Decorated {
}
const modelFile = parent.getModelFile();
if(!modelFile) {
throw new Error('Parent of property ' + this.name + ' does not have a ModelFile!');
throw new IllegalModelException('Parent of property ' + this.name + ' does not have a ModelFile!',modelFile);
subhajit20 marked this conversation as resolved.
Show resolved Hide resolved
}
const result = modelFile.getFullyQualifiedTypeName(this.type);
if(!result) {
throw new Error('Failed to find fully qualified type name for property ' + this.name + ' with type ' + this.type );
throw new TypeNotFoundException(this.type,'Failed to find fully qualified type name for property ' + this.name + ' with type ' + this.type);
subhajit20 marked this conversation as resolved.
Show resolved Hide resolved
}

return result;
Expand Down