Error display format

Asked by Henrik Ziegeldorf

I am writing a small plugin that checks commits for specific criteria.
It runs on the server and should report back to the user if an error occurred.
The protocol being used is bzr+ssh.

How can I report back to the user with a formatted error message?
If I use s.th. like raise errors.BzrErrors("line1 \n line2 ... ") the errormessage is very hard to read at the user's end, because linebreaks are not displayed correctly.

Any suggestions?

Thank you!

Question information

Language:
English Edit question
Status:
Solved
For:
Bazaar Edit question
Assignee:
No assignee Edit question
Solved by:
Andrew Bennetts
Solved:
Last query:
Last reply:
Revision history for this message
Best Andrew Bennetts (spiv) said :
#1

Use the Branch.pre_change_branch_tip hook point, and have your hook function raise TipChangeRejected. TipChangeRejected errors from that hook will be shown cleanly to the client, even over bzr+ssh.

See <http://doc.bazaar.canonical.com/development/en/user-reference/hooks-help.html#post-change-branch-tip> and <http://people.canonical.com/~mwh/bzrlibapi/bzrlib.branch.ChangeBranchTipParams.html>.

Let us know if you need more guidance.

Revision history for this message
Henrik Ziegeldorf (henrik-ziegeldorf) said :
#2

Thanks Andrew Bennetts, that solved my question.