Skip to content

Throw error when trying to access unloaded relationship #96

@kiaking

Description

@kiaking

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 🤔

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions