예제 #1
0
bool ExceptionFullMessage(Exception * E, UnicodeString & Message)
{
  bool Result = ExceptionMessage(E, Message);
  if (Result)
  {
    Message += L"\n";
    ExtException * EE = dyn_cast<ExtException>(E);
    if ((EE != nullptr) && (EE->GetMoreMessages() != nullptr))
    {
      Message += EE->GetMoreMessages()->GetText() + L"\n";
    }
  }
  return Result;
}
예제 #2
0
TStrings * ExceptionToMoreMessages(Exception * E)
{
  TStrings * Result = nullptr;
  UnicodeString Message;
  if (ExceptionMessage(E, Message))
  {
    Result = new TStringList();
    Result->Add(Message);
    ExtException * ExtE = dyn_cast<ExtException>(E);
    if ((ExtE != nullptr) && (ExtE->GetMoreMessages() != nullptr))
    {
      Result->AddStrings(ExtE->GetMoreMessages());
    }
  }
  return Result;
}
예제 #3
0
TStrings * ExceptionToMoreMessages(Exception * E)
{
  TStrings * Result = nullptr;
  UnicodeString Message;
  if (ExceptionMessage(E, Message))
  {
    Result = new TStringList();
    Result->Add(Message);
    ExtException * ExtE = NB_STATIC_DOWNCAST(ExtException, E);
    if ((ExtE != nullptr) && (ExtE->GetMoreMessages() != nullptr))
    {
      Result->AddStrings(ExtE->GetMoreMessages());
    }
  }
  return Result;
}
예제 #4
0
Exception * CloneException(Exception * E)
{
  Exception * Result;
  // this list has to be in sync with ExceptionMessage
  ExtException * Ext = dyn_cast<ExtException>(E);
  if (Ext != nullptr)
  {
    Result = Ext->Clone();
  }
  else if (isa<ECallbackGuardAbort>(E))
  {
    Result = new ECallbackGuardAbort();
  }
  else if (isa<EAbort>(E))
  {
    Result = new EAbort(E->Message);
  }
  else if (WellKnownException(E, nullptr, nullptr, &Result, false))
  {
    // noop
  }
  else
  {
    // we do not expect this to happen
    if (DebugAlwaysFalse(IsInternalException(E)))
    {
      // to save exception stack trace
      Result = ExtException::CloneFrom(E);
    }
    else
    {
      Result = new Exception(E->Message);
    }
  }
  return Result;
}
예제 #5
0
Exception * CloneException(Exception * E)
{
  Exception * Result;
  // this list has to be in sync with ExceptionMessage
  ExtException * Ext = NB_STATIC_DOWNCAST(ExtException, E);
  if (Ext != nullptr)
  {
    Result = Ext->Clone();
  }
  else if (NB_STATIC_DOWNCAST(ECallbackGuardAbort, E) != nullptr)
  {
    Result = new ECallbackGuardAbort();
  }
  else if (NB_STATIC_DOWNCAST(EAbort, E) != nullptr)
  {
    Result = new EAbort(E->Message);
  }
  else if (WellKnownException(E, nullptr, nullptr, &Result, false))
  {
    // noop
  }
  else
  {
    // we do not expect this to happen
    if (ALWAYS_FALSE(IsInternalException(E)))
    {
      // to save exception stack trace
      Result = ExtException::CloneFrom(E);
    }
    else
    {
      Result = new Exception(E->Message);
    }
  }
  return Result;
}