Archived

This forum has been archived. Please start a new discussion on GitHub.

Can user selfdefine exception overload operator

Hi,

As described in the title , I want to get details of the exception ,like the error file and error line ,I see in the generated .h it has no operator<<, how can I get this ,can you give some suggestions?

Thank you .

Sober

Comments

  • In Ice/Exception.h, we define three ostream inserters:
    std::ostream& operator<<(std::ostream&, const LocalException&);
    std::ostream& operator<<(std::ostream&, const UserException&);
    std::ostream& operator<<(std::ostream&, const SystemException&);
    

    You can provide more specialized ostream inserters for derived exceptions, for example:
    std::ostream& operator<<(std::ostream&, const MyFavouriteException&);
    

    That inserter can do whatever you want it to do.

    Cheers,

    Michi.
  • 3x

    thanks,Michi

    I'll try.

    Cheers,
    Sober