Skip to content

Conversation

@kasugamirai
Copy link
Contributor

No description provided.

@reyamir
Copy link
Collaborator

reyamir commented May 30, 2024

Haha, I just revert #196 because it didn't work with Tauri Specta 😅

@reyamir
Copy link
Collaborator

reyamir commented May 30, 2024

But Tauri Specta is necessary for generate typesafe commands, do you know a way to make they work together?
https://github.com/oscartbeaumont/tauri-specta

@kasugamirai
Copy link
Contributor Author

required by package tauri-specta v2.0.0-rc.10
... which satisfies dependency tauri-specta = "=2.0.0-rc.10" of package lume v4.0.0 (/Users/xy/work/freefrom/lume/src-tauri)
versions that meet the requirements =2.0.0-beta.19 are: 2.0.0-beta.19

the package tauri links to the native library Tauri, but it conflicts with a previous package which links to Tauri as well:
package tauri v2.0.0-beta.22, the tauri-specta does not currently support tauri v2.0.0-beta.22

@reyamir
Copy link
Collaborator

reyamir commented May 30, 2024

Specta always update after few days to keep up with latest tauri beta. I think we can wait to update dependencies.
Beside that. I've also caught other problem, this custom Error type isn't working with Specta

#[derive(Debug, Error)]
pub enum Error {
  #[error(transparent)]
  Client(#[from] nostr_sdk::client::Error),
  #[error(transparent)]
  Key(#[from] nostr_sdk::key::Error),
}

I've tried add #[derive(Debug, Error, Type)] which Type is from Specta, but it throw a Error.

@reyamir
Copy link
Collaborator

reyamir commented May 30, 2024

If is there no way to make both work together, I think we can temporary remove Specta, because better error handling is necessary than typesafe commands at this time

@kasugamirai
Copy link
Contributor Author

When I use cargo update, it doesn’t throw the type error, but it shows a link_swift_library error

@kasugamirai
Copy link
Contributor Author

Perhaps we can wait for Specta to update

@reyamir
Copy link
Collaborator

reyamir commented May 30, 2024

When I use cargo update, it doesn’t throw the type error, but it shows a link_swift_library error

Ah, you can use latest commit in main branch which also revert #196, then you just thiserror crate without run cargo update, then add some new error handler code and you will see the error.

@kasugamirai
Copy link
Contributor Author

Yes, I’ve already tried that

@reyamir
Copy link
Collaborator

reyamir commented May 30, 2024

Oh, seems strange, I got this error
image

I've pushed the test branch for repro this issue, can you help me check it

@kasugamirai
Copy link
Contributor Author

Yes, I’ve encountered the same error, but I still don’t know how to fix it

@reyamir
Copy link
Collaborator

reyamir commented May 30, 2024

As far as I found, we need to update Error struct like this

use specta::Type;                                           <- Add specta type

#[derive(Debug, Error, Type)]                       <- Use specta type
pub enum Error {
  #[error(transparent)]
  Client(#[from] nostr_sdk::client::Error),
  #[error(transparent)]
  Key(#[from] nostr_sdk::key::Error),
  #[error(transparent)]
  Num(#[from] std::num::ParseIntError),
}

But we will get other error
image

Look like rust-nostr need to support Specta too.

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