deep-foundation / deeplinks

https://discord.gg/deep-foundation
The Unlicense
14 stars 9 forks source link

Throw proper error if there is no Value link for type #82

Open FreePhoenix888 opened 1 year ago

FreePhoenix888 commented 1 year ago

When we create a type-link:

const {data: [{id: newTypeLinkId}]} = await deep.insert({
  type_id: await deep.id("@deep-foundation/core", "Type")
});

And do not create a Value link from a Type link to a (String)|(Number)|(Object)|(File) link:

// This code should not be executed to reproduce a problem
await deep.insert({
    type_id: await deep.id("@deep-foundation/core", "Value"),
    from_id: newTypeLinkId,
    to_id: await deep.id("@deep-foundation/core", "Number")
})

We get error

ApolloError: field "link_id" not found in type: 'links_insert_input'

But should get something like

A link with type_id ["@deep-foundation/core", "Type"] must be created from typeLinkId to (String)|(Number)|(Object)|(File)LinkId to update a value of a link

Konard commented 1 year ago

Or there should be visual message in user interface in this case this issue should be transferred to deepcase repository.

FreePhoenix888 commented 9 months ago

Or there should be visual message in user interface in this case this issue should be transferred to deepcase repository.

This issue should not be transferred to deepcase repository because we still need proper error for deeplinks users. Of course it would be fine to show what's the problem and how to fix it in deepcase