Skip to content

Incomprehensible exception thrown due to missing var name#546

Merged
kiaking merged 1 commit into
vuex-orm:masterfrom
cuebit:hotfix/fix-undefined-vars
Feb 1, 2020
Merged

Incomprehensible exception thrown due to missing var name#546
kiaking merged 1 commit into
vuex-orm:masterfrom
cuebit:hotfix/fix-undefined-vars

Conversation

@cuebit

@cuebit cuebit commented Jan 29, 2020

Copy link
Copy Markdown
Member

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

codecov Bot commented Jan 29, 2020

Copy link
Copy Markdown

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

kiaking commented Feb 1, 2020

Copy link
Copy Markdown
Member

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.

2 participants