Skip to content

Commit

Permalink
Improve error message
Browse files Browse the repository at this point in the history
  • Loading branch information
aedart committed Feb 23, 2024
1 parent 84f55f7 commit da1a04d
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ export default class AlreadyRegisteredError extends InjectionError implements Al
message?: string,
options?: ErrorOptions
) {
const resolved = message || `Concern ${getNameOrDesc(concern)} is already registered in class ${getNameOrDesc(target)} (via class ${getNameOrDesc(target)})`;
const resolved = message || (target === source)
? `Concern ${getNameOrDesc(concern)} is already registered in class ${getNameOrDesc(target)}`
: `Concern ${getNameOrDesc(concern)} is already registered in class ${getNameOrDesc(target)} (via parent class ${getNameOrDesc(source)})`

super(target, concern, resolved, options);

Expand Down

0 comments on commit da1a04d

Please sign in to comment.