Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Override name in derive #306

Closed

Conversation

tyranron
Copy link

Summary

This PR adds additional #[fail(name = ...)] attribute into failure_derive, which allows to specify custom error's name instead of automatically generated. If no attribute is specified then current behavior is preserved.

Motivation

It appears to be handy to use Fail::name() for custom error codes in the code base of the same application. However, doing so disallows derive usage as we need to implement Fail manually. Having ability to override Fail::name() result in derive simplifies things a lot.

Checklist

  • Tests are added.
  • Documentation is updated.
  • Changelog entry is added.

@tyranron
Copy link
Author

There are some unrelated formatting changes. They are result of running latest stable rustfmt.

@tyranron
Copy link
Author

This also dupes fixes from #298

@tyranron
Copy link
Author

Closing this as project is deprecated.

@tyranron tyranron closed this Aug 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant