]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/exception/example/cloning_1.cpp
1 //Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc.
3 //Distributed under the Boost Software License, Version 1.0. (See accompanying
4 //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6 //This example shows how to enable cloning when throwing a boost::exception.
8 #include <boost/exception/info.hpp>
9 #include <boost/exception/errinfo_errno.hpp>
13 struct file_read_error
: virtual boost::exception
{ };
16 file_read( FILE * f
, void * buffer
, size_t size
)
18 if( size
!=fread(buffer
,1,size
,f
) )
19 throw boost::enable_current_exception(file_read_error()) <<
20 boost::errinfo_errno(errno
);