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

Custom error message #54

Open
naturallymitchell opened this issue Jan 25, 2019 · 11 comments
Open

Custom error message #54

naturallymitchell opened this issue Jan 25, 2019 · 11 comments
Milestone

Comments

@naturallymitchell
Copy link

Would it be possible to set a custom error message?

Perhaps a project could have a text file or config file that it passes as a string to human-panic's sourcing of its text.

This would also fix #7 (comment).

@tisonkun
Copy link
Contributor

tisonkun commented Nov 9, 2023

Here is a similar scenario I met in GreptimeTeam/greptimedb#1165 (comment).

But given that the Metadata interface is public, we can hack into setup_panic for expanding it manually + write our own print_msg.

The tricky part here is how to customize. But accepting a manner config struct to manipulate may be possible.

I can volunteer to make a demo, but it somehow changes the crate's taste or manner, so I don't want to just dive into it unless the maintainers agree on it and help on reviewing.

cc @epage @spacekookie

@epage
Copy link
Collaborator

epage commented Nov 10, 2023

If people have ideas on how to improve the default message, I would love for us to focus on that. However, I recognize that there may be cases for improving it. I'd be interested in looking at proposals for how to be customizing the message. This doesn't have to be code. It can be an API with a description on how to affects the text.

@alejandrodnm
Copy link

alejandrodnm commented Nov 22, 2023

The use case I have right now is that I want to specify more ways for users to report an issue:

- Open a support request from the Timescale console:

  https://console.cloud.timescale.com/dashboard/support

- Open a support request by email to support@timescale.com

- Take your issue to the #migration channel in the community slack, where
  the developers will help:

  https://timescaledb.slack.com/archives/C04PT0Q74EA

I ended up doing it by:

const SUPPORT_MSG: &str = r"https://timescale.com

To submit the crash report:

- Open a support request from the Timescale console:

  https://console.cloud.timescale.com/dashboard/support

- Open a support request by email to support@timescale.com

- Take your issue to the #migration channel in the community slack, where
  the developers will help:

  https://timescaledb.slack.com/archives/C04PT0Q74EA";

let meta = Metadata {
                version: env!("CARGO_PKG_VERSION").into(),
                name: env!("CARGO_PKG_NAME").into(),
                authors: "".into(),
                homepage: SUPPORT_MSG.into(),
};

@tisonkun
Copy link
Contributor

I propose a patch - #122

There can be a lot of things to be improved, but let's first discuss if the direction is desired.

That is - introduce a Writer/Printer trait for customizing panic message; may or may not we can extend metadata struct later.

The proposed change is backward compatible.

@epage
Copy link
Collaborator

epage commented Nov 27, 2023

If the focus is on additional links, what if we provided ways for people to extend specifically that?

I'd like for us to share what we can so if things are improved for one, they are improved for all.

@tisonkun
Copy link
Contributor

If the focus is on additional links, what if we provided ways for people to extend specifically that?

I'd like for us to share what we can so if things are improved for one, they are improved for all.

LGTM. Send #133 for review.

@terakilobyte
Copy link

We don't want anyone sending an email, so I propose the ability to specify the report section. I'd be happy to submit a PR if it would be acceptable and helpful.

@epage
Copy link
Collaborator

epage commented Jul 18, 2024

Likely "email" should just be removed

@terakilobyte
Copy link

I believe the entire sentence beginning with "Submit an issue or email..." could safely be removed and handled in the support section.

@epage
Copy link
Collaborator

epage commented Jul 18, 2024

We need the link to the file and I think its important to call out that the support the file should be used in the support method. As people likely haven't written their support methods to mention it, leaving it solely to that would be a regression for these users and I'd prefer to use a breaking change for such a regression.

@terakilobyte
Copy link

I absolutely agree the file should be linked. I've submitted a draft PR to more clearly capture what I was thinking.

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 a pull request may close this issue.

6 participants