Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incomprehensible exception thrown due to missing var name #546

Merged
merged 1 commit into from
Feb 1, 2020

Conversation

cuebit
Copy link
Member

@cuebit cuebit commented Jan 29, 2020

This PR fixes an incomprehensible exception thrown when attempting to register a model that references an absent one (either it was not registered or doesn't exist) or context based retrieval.

Exception thrown:

[Vuex ORM] Could not find the model ``. Please check if you have registered the model to the database.

Previously it stated the suspect model entity but an undeclared variable in the error message prohibits this.

Model definition:

class User extends Model {
  static entity = 'users';
  static fields() {
    return {
      id: this.attr(null),
      role: this.hasOne('nonregistered')
    }
  }
}

Context based:

new Database().model('nonregistered')

$store.$db().model('nonregistered')

@codecov
Copy link

codecov bot commented Jan 29, 2020

Codecov Report

Merging #546 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #546   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          47     47           
  Lines        1835   1837    +2     
  Branches      255    255           
=====================================
+ Hits         1835   1837    +2
Impacted Files Coverage Δ
src/database/Database.ts 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 84e1219...d63e834. Read the comment docs.

@kiaking
Copy link
Member

kiaking commented Feb 1, 2020

Ahhh good point! Thanks! Awesome.

@kiaking kiaking merged commit d0ea75e into vuex-orm:master Feb 1, 2020
@cuebit cuebit deleted the hotfix/fix-undefined-vars branch February 2, 2020 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants