diff --git a/lib/ansible/module_utils/junos.py b/lib/ansible/module_utils/junos.py
index 730839bbd5c..7fe6650015b 100644
--- a/lib/ansible/module_utils/junos.py
+++ b/lib/ansible/module_utils/junos.py
@@ -139,6 +139,9 @@ class Netconf(object):
                 responses[index] = xml_to_json(responses[index])
             elif cmd.args.get('command_type') == 'rpc':
                 responses[index] = str(responses[index].text).strip()
+            elif 'RpcError' in responses[index]:
+                raise NetworkError(responses[index])
+
 
         return responses