Re: server-side extension in c++

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: server-side extension in c++
Дата
Msg-id AANLkTinbK8bmTwKWxd71WZdzdhnsuFUIvAzhsXpHPDYQ@mail.gmail.com
обсуждение исходный текст
Ответ на Re: server-side extension in c++  (David Fetter <david@fetter.org>)
Список pgsql-general
> It's good to have actual working code in production to bolster the
> case that the design is sound.
>
> How much work would it be to refactor libgeos_c to use a catch-all
> exception handler?
>

Well, they'd have to be using specific exception handlers to get the
error message. Perhaps they just have one per wrapper function like
this (assuming their exception objects ultimately inherit from
std::exception, which they all ought to):

...
char* error_string;
...
catch(const std::exception& e)
{
    error_string = malloc(strlen(e.what()) + 1 );
    if(error_string != NULL)
         strcpy(error_string, e.what());
    return false;
}
// They could add this catch-all, which we could fall back on to be on
the safe side
catch(...)
{
   // We can't do anything except swallow - this could be anything
that doesn't inherit from std::exception
}

--
Regards,
Peter Geoghegan

В списке pgsql-general по дате отправления:

Предыдущее
От: "Bob Pawley"
Дата:
Сообщение: Re: Installing version 8.4
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: create index concurrently - duplicate index to reduce time without an index