| 67 | } |
| 68 | |
| 69 | void RPCTypeCheck(const UniValue& params, |
| 70 | const list<UniValue::VType>& typesExpected, |
| 71 | bool fAllowNull) |
| 72 | { |
| 73 | unsigned int i = 0; |
| 74 | BOOST_FOREACH(UniValue::VType t, typesExpected) |
| 75 | { |
| 76 | if (params.size() <= i) |
| 77 | break; |
| 78 | |
| 79 | const UniValue& v = params[i]; |
| 80 | if (!((v.type() == t) || (fAllowNull && (v.isNull())))) |
| 81 | { |
| 82 | string err = strprintf("Expected type %s, got %s", |
| 83 | uvTypeName(t), uvTypeName(v.type())); |
| 84 | throw JSONRPCError(RPC_TYPE_ERROR, err); |
| 85 | } |
| 86 | i++; |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | void RPCTypeCheckObj(const UniValue& o, |
| 91 | const map<string, UniValue::VType>& typesExpected, |
no outgoing calls
no test coverage detected