Difference between return Error and throw Error
问题 I found the following code in a project, that I do not understand.: get(key, store = null) { if (!key) { return new Error('There is no key to get!'); } let dbstore = this.localforage; if (store !== null) { dbstore = store; } return dbstore .getItem(key) .then(function(value) { return value; }) .catch(function(err) { return new Error('The key (' + key + ") isn't accessible: " + err); }); } Why return new Error('There is no key to get!'); instead of throw new Error('There is no key to get!'); ?