Skip to content
Snippets Groups Projects
Commit 6aa71775 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

MAINT: change vanilla exception to more specific one

parent 71fd8983
Branches
Tags
1 merge request!17F file read error
Pipeline #12544 passed with warnings
Pipeline: caosdb-cppinttest

#12546

    ......@@ -62,6 +62,7 @@ enum StatusCode {
    FILE_UPLOAD_ERROR = 35,
    FILE_DOWNLOAD_ERROR = 36,
    ENUM_MAPPING_ERROR = 37,
    FILE_CANNOT_BE_READ = 38,
    OTHER_CLIENT_ERROR = 9999,
    };
    ......
    ......@@ -35,6 +35,7 @@
    #include <fstream>
    #include <iostream>
    #include <map>
    #include "caosdb/exceptions.h"
    #include <memory>
    #include <mutex>
    #include <shared_mutex>
    ......@@ -90,7 +91,12 @@ auto getEnumValueFromName<caosdb::entity::Role>(const std::string &name) -> caos
    */
    inline auto load_string_file(const path &path) -> std::string {
    std::string result;
    boost::filesystem::load_string_file(path, result);
    try {
    boost::filesystem::load_string_file(path, result);
    } catch (const std::exception &exc) {
    throw caosdb::exceptions::Exception(StatusCode::FILE_CANNOT_BE_READ ,
    "Cannot read the following file: "+ path.string());
    }
    return result;
    }
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment