Skip to content

Commit

Permalink
feat(core): use model's name on mapping error message (#518)
Browse files Browse the repository at this point in the history
  • Loading branch information
micalevisk committed Mar 10, 2023
1 parent 271f31d commit 09bb926
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/core/src/lib/utils/get-mapping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ export function getMapping(
?.get(destinationIdentifier);

if (mapping == null && !allowNull) {
const sourceName =
typeof source === 'function' ? (source.name || String(source)) : String(source);
const destinationName =
typeof destination === 'function' ? (destination.name || String(destination)) : String(destination);
const errorHandler = getErrorHandler(mapper);
const errorMessage = `Mapping is not found for ${String(
source
)} and ${String(destination)}`;
const errorMessage = `Mapping is not found for ${sourceName} and ${destinationName}`;
errorHandler.handle(errorMessage);
throw new Error(errorMessage);
}
Expand Down

0 comments on commit 09bb926

Please sign in to comment.