Revision 4dd42c9d

b/daemons/ganeti-noded
93 93
      raise http.HttpNotFound()
94 94

  
95 95
    try:
96
      return method(req.request_body)
96
      rvalue = method(req.request_body)
97
      if not isinstance(rvalue, tuple):
98
        return (False, "Invalid result from backend function: expected"
99
                " tuple, got %s" % type(rvalue))
100
      elif len(rvalue) != 2:
101
        return (False, "Invalid result from backend function: expected"
102
                " 2-element tuple, got tuple of length %d" % len(rvalue))
103
      else:
104
        return rvalue
105

  
97 106
    except backend.RPCFail, err:
98 107
      # our custom failure exception; str(err) works fine if the
99 108
      # exception was constructed with a single argument, and in
......
107 116
      # And return the error's arguments, which must be already in
108 117
      # correct tuple format
109 118
      return err.args
110
    except:
119
    except Exception, err:
111 120
      logging.exception("Error in RPC call")
112
      raise
121
      return False, "Error while executing backend function: %s" % str(err)
113 122

  
114 123
  # the new block devices  --------------------------
115 124

  

Also available in: Unified diff