Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error handling overhaul #49

Merged
merged 3 commits into from
Dec 14, 2015
Merged

Conversation

emberian
Copy link
Contributor

@emberian emberian commented Dec 5, 2015

This yanks out all the String types in Results and replaces them
with fine-grained enums.

Closes #45

This yanks out all the String types in Results and replaces them
with fine-grained enums.

Closes Stebalien#45
/// Indicates that the terminal does not support the requested color.
///
/// This is like `AttributeNotSupported`, but more specific.
ColorNotSupported,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a non-exhaustive variant?

    #[doc(hidden)]
    __Nonexhaustive,

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't ColorNotSupported be ColorOutOfRange (or something like that? ColorNotSupported makes it sound like color isn't supported in general.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ColorOutOfRange seems a bit weird to me as a name, since I usually think of ranges as approximating some continuous monotonic spectrum, which these colors don't. But, I can't think of a better name and agree that this is a bad name.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. How about UnsupportedColor?

On 12-13-15, cmr wrote:

  • TerminfoParsing(terminfo::Error),
  • /// Indicates an error expanding a parameterized string from the terminfo database
  • ParameterizedExpansion(terminfo::parm::Error),
  • /// Indicates that the terminal does not support the requested attribute
  • AttributeNotSupported,
  • /// Indicates that the TERM environment variable was unset, and thus we were unable to detect
  • /// which terminal we should be using.
  • TermUnset,
  • /// Indicates that we were unable to find a terminfo entry for the requested terminal.
  • TerminfoEntryNotFound,
  • /// Indicates that the cursor could not be moved to the requested position.
  • CursorDestinationInvalid,
  • /// Indicates that the terminal does not support the requested color.
  • ///
  • /// This is like AttributeNotSupported, but more specific.
  • ColorNotSupported,

ColorOutOfRange seems a bit weird to me as a name, since I usually think of ranges as approximating some continuous monotonic spectrum, which these colors don't. But, I can't think of a better name and agree that this is a bad name.


Reply to this email directly or view it on GitHub:
https://github.com/Stebalien/term/pull/49/files#r47454390

Steven Allen
(310) 433-5865
((Do Not Email honeypot@stebalien.com))

@Stebalien
Copy link
Owner

Nice! 👏 (although the tests still need to be fixed).

@Stebalien
Copy link
Owner

ping

/// Indicates an error expanding a parameterized string from the terminfo database
ParameterizedExpansion(terminfo::parm::Error),
/// Indicates that the terminal does not support the requested attribute
AttributeNotSupported,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we change this to a more generic NotSupported (or OperationNotSupported)? #50 needs a way to say that querying the terminal size isn't supported.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy with NotSupported.

@emberian
Copy link
Contributor Author

Sorry for the long delays with this, I just finished up with final exams.

@emberian
Copy link
Contributor Author

@Stebalien updated.

@Stebalien
Copy link
Owner

No problem; I figured that might be the case. FYI, the windows terminal still needs some of it's Ok(bool)s replaced.

Also, unrelated but would you like push access? This is really your crate.

@emberian
Copy link
Contributor Author

I'm happy going through pull requests (it is the GitHub Way ™️ afterall).

Stebalien added a commit that referenced this pull request Dec 14, 2015
@Stebalien Stebalien merged commit 92a94ac into Stebalien:master Dec 14, 2015
@Stebalien
Copy link
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants