Skip to content

Commit c03f6b2

Browse files
author
Sam Clements
committed
Display RiemannErrors nicely when using the command line client (closes #5)
1 parent c01dd58 commit c03f6b2

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

riemann_client/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
"""A Python Riemann client and command line tool"""
22

3-
__version__ = '4.0.1'
3+
__version__ = '4.1.0-dev'
44
__author__ = 'Sam Clements <sam.clements@datasift.com>'

riemann_client/command.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import argparse
66
import json
7+
import sys
78
import os
89

910
import riemann_client.client
@@ -102,4 +103,9 @@ def main():
102103
transport = transport_class(args.host, args.port)
103104

104105
with riemann_client.client.Client(transport=transport) as client:
105-
args.function(args, client)
106+
try:
107+
args.function(args, client)
108+
except riemann_client.transport.RiemannError as exception:
109+
print("The Riemann server responded with an error: {}".format(
110+
exception.message), file=sys.stderr)
111+
exit(1)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
setuptools.setup(
66
name='riemann-client',
7-
version='4.0.1',
7+
version='4.1.0-dev',
88

99
author="Sam Clements",
1010
author_email="sam.clements@datasift.com",

0 commit comments

Comments
 (0)