| 199 | |
| 200 | template< typename F > |
| 201 | bool throws_fs_error(F func, errno_t en, int line) |
| 202 | { |
| 203 | try |
| 204 | { |
| 205 | func(); |
| 206 | } |
| 207 | catch (const fs::filesystem_error& ex) |
| 208 | { |
| 209 | if (report_throws) |
| 210 | { |
| 211 | // use the what() convenience function to display exceptions |
| 212 | cout << "\n" |
| 213 | << ex.what() << "\n"; |
| 214 | } |
| 215 | if (en == 0 || en == ex.code().default_error_condition().value()) |
| 216 | return true; |
| 217 | cout |
| 218 | << "\nWarning: line " << line |
| 219 | << " exception reports default_error_condition().value() " |
| 220 | << ex.code().default_error_condition().value() |
| 221 | << ", should be " << en |
| 222 | << "\n value() is " << ex.code().value() |
| 223 | << endl; |
| 224 | return true; |
| 225 | } |
| 226 | return false; |
| 227 | } |
| 228 | |
| 229 | struct poison_category_impl : public boost::system::error_category |
| 230 | { |