Skip to content

Invalid Arguments Error name format check #52

@ifraixedes

Description

@ifraixedes

The error::Args struct which is used for the error:Error::InvalidArguments variant specifies the format of the name field value.

error::Args::new constructor doesn't check the value of the passed argument to assign to the name field, so developers can use an invalid format without being aware of causing a bug. This format is useful for developers to find out to developers who use the uplink crate to understand that they are calling a public API with an invalid argument, so if the format is wrong it would cause confusion to the end developers.

Because passing an invalid name format is a bug, I was thinking that this should panic; returning a Result doesn't seem to make a lot of sense because how should this error have to be handled?. I understand that panic sounds a no-go for some people, but if the end developer gets a panic he will understand right away there is a bug in the crate and hopefully will open an issue and it will be fix quickly.

Find the place to add this check by searching in the sources TODO(https://github.com/storj-thirdparty/uplink-rust/issues/52).

Metadata

Metadata

Assignees

No one assigned

    Labels

    crate:uplinkSpecific issues / PRs for uplink cratetype:enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions