coveralls: 
[![Coverage Status](https://coveralls.io/builds/8370776/badge)](https://coveralls.io/builds/8370776)

Coverage increased (+14.3%) to 84.848% when pulling **d332fb358942fb35d8d2c960728665cc126f6192 on error-handling** into **89b6ea235226cbc51f3f47f8051bcd8305ff447f on master**.

diff --git a/jqp/__init__.py b/jqp/__init__.py
index 9638c44..cdcc02e 100644
--- a/jqp/__init__.py
+++ b/jqp/__init__.py
@@ -6,19 +6,44 @@ import sys
 __version__ = '0.0.0.1'
 
 
+def _exit(error, return_code, message):
+    sys.stderr.write(message)
+    sys.stderr.write('\nOiginal error: ')
+    sys.stderr.write(str(error))
+    sys.stderr.write('\n')
+    sys.exit(return_code)
+
+
 def run(in_io, out_io, cmd):
-    for line in in_io:
+    for i, line in enumerate(in_io):
         if line.strip() == '':
             continue
-        js = json.loads(line)
-        out = eval(cmd, {'j': js})
-        json.dump(out, out_io)
+
+        line_no = i + 1
+        try:
+            js = json.loads(line)
+        except Exception as e:
+            _exit(e, 4, 'Parse error: line %d' % line_no)
+
+        try:
+            out = eval(cmd, {'j': js})
+        except Exception as e:
+            _exit(e, 3, 'Cannot execute command: line %d' % line_no)
+
+        try:
+            json.dump(out, out_io)
+        except Exception as e:
+            _exit(e, 3, 'Cannot dump result: line %d' % line_no)
+
         out_io.write('\n')
 
 
 def main():
     parser = argparse.ArgumentParser()
     parser.add_argument('cmd')
+    parser.add_argument(
+        '--version', action='version', version='jqp %s' % __version__,
+        help='show version and exit')
     args = parser.parse_args()
 
     run(sys.stdin, sys.stdout, args.cmd)

Error handling
Don't show stacktrace.
diff --git a/tests/run_test.py b/tests/run_test.py
index 185ce17..31ceb87 100644
--- a/tests/run_test.py
+++ b/tests/run_test.py
@@ -15,3 +15,24 @@ class RunTest(unittest.TestCase):
         outputs = StringIO()
         jqp.run(inputs, outputs, 'j["name"]')
         self.assertEqual(outputs.getvalue(), '"Taro"\n')
+
+    def test_parse_error(self):
+        inputs = StringIO('invalid\n')
+        outputs = StringIO()
+        with self.assertRaises(SystemExit) as e:
+            jqp.run(inputs, outputs, 'j')
+        self.assertEqual(e.exception.code, 4)
+
+    def test_execution_error(self):
+        inputs = StringIO('1\n')
+        outputs = StringIO()
+        with self.assertRaises(SystemExit) as e:
+            jqp.run(inputs, outputs, 'invalid')
+        self.assertEqual(e.exception.code, 3)
+
+    def test_dump_error(self):
+        inputs = StringIO('1\n')
+        outputs = StringIO()
+        with self.assertRaises(SystemExit) as e:
+            jqp.run(inputs, outputs, 'lambda: 0')
+        self.assertEqual(e.exception.code, 3)

pip install -e .
parse_log_pytest
requirements.txt
pytest pytest-cov
apt-get update apt-get install -y gcc
3.5
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
certifi==2021.5.30
coverage==6.2
importlib-metadata==4.8.3
iniconfig==1.1.1
-e git+https://github.com/unnonouno/jqp.git@89b6ea235226cbc51f3f47f8051bcd8305ff447f#egg=jqp
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0

name: jqp
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - coverage==6.2
      - importlib-metadata==4.8.3
      - iniconfig==1.1.1
      - packaging==21.3
      - pluggy==1.0.0
      - py==1.11.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - pytest-cov==4.0.0
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - zipp==3.6.0
prefix: /opt/conda/envs/jqp

tests/run_test.py::RunTest::test_dump_error tests/run_test.py::RunTest::test_execution_error tests/run_test.py::RunTest::test_parse_error
tests/run_test.py::RunTest::test1
jqp/__init__.py
jqp/__init__.py