anchor.diff:                        %% Reserve one third for the stacktrace.
                         CharsLimit div 3
                 end,
  -    St = format_stacktrace1(S, Trace, FormatFun, StackFun, Encoding, StLimit, Reason),
  +
  +    ErrorMap = get_extended_error(Reason, Trace),
  +
  +    St = format_stacktrace1(S, Trace, FormatFun, StackFun,
  +                            Encoding, StLimit, Reason, ErrorMap),
       Lim = sub(sub(CharsLimit, exited(Class), latin1), St, Encoding),
  -    Expl0 = explain_reason(Term, Class, Trace1, FormatFun, S, Encoding, Lim),
  +    DefaultReason = explain_reason(Term, Class, Trace1, FormatFun, S, Encoding, Lim),
  +    Expl0 = maps:get(reason, ErrorMap, DefaultReason),
  +
       FormatString = case Encoding of
                          latin1 -> "~s~s";
                          _ -> "~s~ts"
  
positive.code:             #{}
      end.
  
  format_arg_errors(ArgNum, [_|As], ErrorMap) ->
      case ErrorMap of
          #{ArgNum := Err} ->
  
negative.code:             lists:join([$\n,Sep,<<"   ">>], [""|Errors])
      end.
  
  get_extended_error(Reason, [{M,_F,_As,Info}|_] = StackTrace) ->
      case lists:keyfind(error_info, 1, Info) of
          {error_info,ErrorInfoMap} when is_map(ErrorInfoMap) ->
              FormatModule = maps:get(module, ErrorInfoMap, M),
  