The case is user use 0x1} as a hex value for Pcd, it directly cause
tool report traceback info. This patch add more error info.
Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Value = Value.strip().strip('"')\r
return ParseDevPathValue(Value)\r
if Value.lower().startswith('0x'):\r
- Value = int(Value, 16)\r
+ try:\r
+ Value = int(Value, 16)\r
+ except:\r
+ raise BadExpression("invalid hex value: %s" % Value)\r
if Value == 0:\r
return 0, 1\r
return Value, (Value.bit_length() + 7) / 8\r