Change Box dyn to Send everytime?

Hello,

Does it cause any harm to always have
Result<Whatever, Box<dyn Error + Send + Sync>>
vs
Result<Whatever, Box<dyn Error>>

Asking because having both sync and async code, the former always works whereas the later no.

and return Err("My error here".into()) is easy enough.
Thank you

Well, they are not the same, so there must logically be cases in which one is usable and the other is not. Trivially, if you always insist on Box<… + Send + Sync>, then you won't be able to construct this from errors that do not implement Send + Sync. That's usually not a problem in practice, but you do need to keep it in mind.

Incidentally, for managing custom error types, use thiserror or anyhow.

Thank you,

I will look into them