Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • gstreamer-rs gstreamer-rs
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 40
    • Issues 40
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 10
    • Merge requests 10
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GStreamer
  • gstreamer-rsgstreamer-rs
  • Issues
  • #2

Closed
Open
Created Aug 02, 2017 by Sebastian Dröge@slomo🍵Owner

Proper error handling in examples

All the unwrap()s are ugly and we can easily do better.

Idea would be to have main be a function that just calls run or a couple of other functions returning a Result<_,_> and it's only job is to destructure that and print any possible errors.

For each example we would then define an error enum (that implements Display, Error and what else) like

enum MyLittleError {
    MissingElement(&str),
    LinkingFailed(&str, &str),
    Other(&str),
}

and return those from the functions, ideally making use of the ?-operator and various Option<_> / Result<_, _> combinators, e.g. gst::ElementFactory::make("appsrc", None).ok_or(MyLittleError::MissingElement("appsrc"))?;.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking