Comments (4)
I agree this would be helpful
from transit_model.
This message comes directly from https://github.com/CanalTP/typed_index_collection/blob/v1.1.0/src/error.rs#L7. The type of object is not known inside this generic library (we know the struct
but can't really display anything). I see a few options on how to handle this problem (there might be more).
Fix in typed_index_collection
Doing this probably means to add an additional constraint on T
like T: Display
or T: Debug
in order to be able to display the struct
of the type of object.
I'm not really in favor of that solution because:
- adding a constraint only for reporting feels wrong (and might reduce the capabilities of
typed_index_collection
) - implementation of
Display
orDebug
is likely to not show only the type but the entire object, we don't have control on how users will implement these traits.
Introduce a Trait
To fix the previous solution, we could introduce a specific trait typed_index_collection::ObjectType
for example. It's still adding a constraint to T
but at least, we do not depend on implementation of Debug
or Display
that might not be to our taste.
Handle errors in transit_model
Most likely, we're gonna be able to create better error in transit_model
. With thiserror
for example, we could do something like this.
enum ObjectType {
Network,
Line,
Etc,
} // Implement Display on that `enum`
#[derive(Error)]
enum TMError {
#[error("identifier {1} of type {0} already exists")]
IdentifierAlreadyExists(ObjectType, String, #[source] typed_index_collection::Error)
#[error("other error")]
OtherError,
}
Since we have plans to migrate transit_model
from failure
to a more modern framework (thiserror
has been discussed for example), maybe this issue can be adressed once the migration happened? Note that we plan to do it but we didn't scheduled it yet and have no idea when it could happen.
from transit_model.
will be closed by hove-io/typed_index_collection#11 no?
from transit_model.
I don't think so since this piece of code is not going to output the type of object. However, we might be a step closer to achieve that.
from transit_model.
Related Issues (20)
- gtfs2netexfr installation issue HOT 11
- merge-ntfs HOT 2
- gtfs2ntfs : new way to generate prefixes ? HOT 4
- Error reading "./ntfs/feed_infos.txt" HOT 3
- Add more flexibility to read inputs HOT 1
- [tech] Easier hello world HOT 8
- Allow reading GTFS csv files with a flexible option for columns number HOT 2
- Do gtfs2netexfr handle the pathways and levels GTFS extensions ? HOT 1
- FR: prefixes dans les id HOT 4
- Coordonnées WGS HOT 5
- SiteConnection id not unique HOT 2
- [tech] Improve ignored doc-tests
- [gtfs2netexfr] Help needed to pinpoint cause of "unused lines" pruning HOT 3
- transit_model fails to open zipped file. HOT 8
- TransXChange format HOT 1
- ODT : incorrect behavior ? HOT 10
- Problem with cargo install --path gtfs2netexfr HOT 4
- gtfs2netexfr : wrong StopPlaceType for bus HOT 5
- Dependency minidom 0.12 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from transit_model.