Skip to content

error message transformer #86

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

Closed
wants to merge 4 commits into from
Closed

error message transformer #86

wants to merge 4 commits into from

Conversation

robertroeser
Copy link
Member

Added a transformer in the Frame.Error class to suck in the whole stack trace and send that as an error message payload optionally.

PrintWriter printWriter = new PrintWriter(writer);
throwable.printStackTrace(printWriter);
String data = writer.toString();
byte[] bytes = data.getBytes(Charset.forName("UTF-8"));
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: You can use StandardCharsets.UTF_8 instead of charset lookup.

@NiteshKant
Copy link
Contributor

I am not a big fan of sending stacktraces back to the caller over the network but if you think it is useful 👍

StringWriter writer = new StringWriter();
PrintWriter printWriter = new PrintWriter(writer);
throwable.printStackTrace(printWriter);
String data = writer.toString();
Copy link
Member

Choose a reason for hiding this comment

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

I would prepend throwable.getMessage() == null ? "" : throwable.getMessage(); to the data String (sperated by new line) so that in both cases the data starts by the same thing.

@stevegury
Copy link
Member

👍

@NiteshKant
Copy link
Contributor

Closing this in preparation for the latest code push (ref #175)

@NiteshKant NiteshKant closed this Oct 20, 2016
ilayaperumalg pushed a commit to ilayaperumalg/rsocket-java that referenced this pull request Dec 26, 2017
Clean up lots of typos and grammar in FAQ
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.

3 participants