Skip to content

Fixed bug with parsing message of UBError - it does look like JSON string, not an original message

Andrii Bezuglyi requested to merge bug/UBError-message-parsing into master

String caught by regexp is caught from JSON representation, not from original error message, therefore, the error message is JSON encoded string, which means the double-quotes would be encoded with backslashes, which does not look good. For example, if message was "code" attribute shall be a valid identifier, it will displayed as \"code\" attribute shall be a valid identifier

I mean, when you do

    if (/<<<.*>>>/.test(errInfo.errMsg)) {
      // ...

You actually regexp-ing against a JSON. errMsg is a JSON with a lot of stuff in there.

Is it always JSON though? It comes from server, please check it...

Fixed by enclosing the string (which, again shall be part of a JSON string) in double-quotes and JSON-parse the result, which IMO is correct, if errMgs is always JSON.

Edited by Andrii Bezuglyi

Merge request reports