Repository: microsoft/terminal (language: cpp)

Issue:
JSON deserializer errors don't render properly when an unexpected object is encountered
If you have this in a profile...

```json
"colorScheme": {}
```

you get a weird error message:

<img width="392" alt="image" src="https://user-images.githubusercontent.com/189190/201446111-1a8cf555-3970-4c20-842f-719fdd385afb.png">

It's happening because we try to format the JSON object for display in the error message using `asString`, but Objects cannot be rendered via `asString`.

I swear this used to work (and say something like `unexpected: object`), but I can't figure out why it regressed.


Discussion / hints:

Fix patch:
diff --git a/src/cascadia/TerminalSettingsModel/JsonUtils.h b/src/cascadia/TerminalSettingsModel/JsonUtils.h
index c53a0afc59c..693ac798462 100644
--- a/src/cascadia/TerminalSettingsModel/JsonUtils.h
+++ b/src/cascadia/TerminalSettingsModel/JsonUtils.h
@@ -101,7 +101,7 @@ namespace Microsoft::Terminal::Settings::Model::JsonUtils
     {
     public:
         DeserializationError(const Json::Value& value) :
-            runtime_error(std::string("failed to deserialize ") + (value.isNull() ? "" : value.asString())),
+            runtime_error(std::string{ "failed to deserialize JSON value" }),
             jsonValue{ value } {}
 
         void SetKey(std::string_view newKey)


Test patch: