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

Throw error when trying to access unloaded relationship #96

Open
kiaking opened this issue Nov 8, 2021 · 0 comments
Open

Throw error when trying to access unloaded relationship #96

kiaking opened this issue Nov 8, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@kiaking
Copy link
Member

kiaking commented Nov 8, 2021

Currently, when relationships are not loaded, it becomes undefined. How about we throw an error when accessing unloaded relationships?

const user = userRepo.find(1)

user.posts // Error('relationship is not loaded')

This might make it easier to catch errors where people forget to load them, and try to access it 🤔

@kiaking kiaking added the enhancement New feature or request label Nov 8, 2021
@kiaking kiaking added this to the v1.0.0-alpha.1 milestone Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant