Skip to content

Proper error handling #3

Open
Open
@hellow554

Description

@hellow554

/// Also perform WiFi Geolocation if it is enabled. Return 0 if successful.
pub fn start_network_task() -> i32 {
console_print(b"start_network_task\n");
0
}

Immediatly as I saw the video in the medium post I shuddered.

Do proper error handling in Rust!

Don't return ints to indicate errors or failures, use Result<(), ErrorType> instead. This is just one place, but everywhere where you have those ghastly assert!(rc == 0) things, throw them away and burn them! Either use unwrap, or better expect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions