From b4bb6912f68f476a1525c0059166e7d0cb67e6c3 Mon Sep 17 00:00:00 2001 From: Chris Jensen <2920476+chrisjensen@users.noreply.github.com> Date: Wed, 7 Aug 2019 14:34:21 +0800 Subject: [PATCH] Name model that association is missing from As the missing include error comes up in async code, it can be hard to trace the caller. Propose adding the name of the model that the association cannot be found on so as to give more context for debugging. --- lib/model.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/model.js b/lib/model.js index 035cb5bfc520..5ac6f28fc248 100644 --- a/lib/model.js +++ b/lib/model.js @@ -329,7 +329,7 @@ class Model { static _transformStringAssociation(include, self) { if (self && typeof include === 'string') { if (!Object.prototype.hasOwnProperty.call(self.associations, include)) { - throw new Error(`Association with alias "${include}" does not exist`); + throw new Error(`Association with alias "${include}" does not exist on ${self.name}`); } return self.associations[include]; }