Skip to content

Commit

Permalink
fix(templatesUsePublicRule): Pass member name back through error
Browse files Browse the repository at this point in the history
Pass the class member name to the error for more clarification

fixes mgechev#229
  • Loading branch information
comfroels committed Feb 19, 2017
1 parent 84260b6 commit 0b7e459
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/templatesUsePublicRule.ts
Expand Up @@ -41,7 +41,7 @@ class SymbolAccessValidator extends RecursiveAngularExpressionVisitor {
.some(m => m.kind === SyntaxKind.current().PrivateKeyword || m.kind === SyntaxKind.current().ProtectedKeyword);
const width = ast.name.length;
if (!isPublic) {
const failureString = 'You can bind only to public class members.';
const failureString = `You can bind only to public class members. ${member.name.getText()} is not a public class member.`;
this.addFailure(this.createFailure(ast.span.start, width, failureString));
}
}
Expand Down
12 changes: 6 additions & 6 deletions test/templatesUsePublicRule.spec.ts
Expand Up @@ -12,7 +12,7 @@ describe('templates-use-public', () => {
constructor(private foo: number) {}
}`;
assertFailure('templates-use-public', source, {
message: 'You can bind only to public class members.',
message: 'You can bind only to public class members. foo is not a public class member.',
startPosition: {
line: 3,
character: 24
Expand All @@ -34,7 +34,7 @@ describe('templates-use-public', () => {
private foo: number;
}`;
assertFailure('templates-use-public', source, {
message: 'You can bind only to public class members.',
message: 'You can bind only to public class members. foo is not a public class member.',
startPosition: {
line: 3,
character: 29
Expand All @@ -56,7 +56,7 @@ describe('templates-use-public', () => {
protected foo: number;
}`;
assertFailure('templates-use-public', source, {
message: 'You can bind only to public class members.',
message: 'You can bind only to public class members. foo is not a public class member.',
startPosition: {
line: 3,
character: 29
Expand All @@ -78,7 +78,7 @@ describe('templates-use-public', () => {
protected foo: number;
}`;
assertFailure('templates-use-public', source, {
message: 'You can bind only to public class members.',
message: 'You can bind only to public class members. foo is not a public class member.',
startPosition: {
line: 3,
character: 29
Expand All @@ -100,7 +100,7 @@ describe('templates-use-public', () => {
protected foo: number;
}`;
assertFailure('templates-use-public', source, {
message: 'You can bind only to public class members.',
message: 'You can bind only to public class members. foo is not a public class member.',
startPosition: {
line: 3,
character: 35
Expand All @@ -122,7 +122,7 @@ describe('templates-use-public', () => {
protected foo() {};
}`;
assertFailure('templates-use-public', source, {
message: 'You can bind only to public class members.',
message: 'You can bind only to public class members. foo is not a public class member.',
startPosition: {
line: 3,
character: 33
Expand Down

0 comments on commit 0b7e459

Please sign in to comment.