On Fri, Jan 7, 2011 at 15:02, Iustin Pop <[email protected]> wrote:

> Currently, we list the entire object in error messages. But for large
> objects (e.g. an IAllocator message), this makes the output
> unreadable, as the elements are containers themselves.
>
> To simplify the reporting, we only list the keys, as this is more
> relevent than the values.
> ---
>  Ganeti/HTools/Utils.hs |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/Ganeti/HTools/Utils.hs b/Ganeti/HTools/Utils.hs
> index 1e58bc3..5611dbc 100644
> --- a/Ganeti/HTools/Utils.hs
> +++ b/Ganeti/HTools/Utils.hs
> @@ -130,7 +130,8 @@ loadJSArray s = fromJResult s . J.decodeStrict
>  fromObj :: (J.JSON a, Monad m) => [(String, J.JSValue)] -> String -> m a
>  fromObj o k =
>     case lookup k o of
> -      Nothing -> fail $ printf "key '%s' not found in %s" k (show o)
> +      Nothing -> fail $ printf "key '%s' not found, object contains only
> %s"
> +                 k (show (map fst o))
>       Just val -> fromKeyValue k val
>
>  -- | Reads the value of an optional key in a JSON object.
> --
> 1.7.3.1
>
>
LGTM

Reply via email to