Always use our own exception tree
This commit is contained in:
@@ -288,7 +288,7 @@ LmsApplication::handleAuthEvent()
|
||||
catch (std::exception& e)
|
||||
{
|
||||
LMS_LOG(UI, ERROR) << "Error while handling auth event: " << e.what();
|
||||
throw std::runtime_error("Internal error");
|
||||
throw LmsException("Internal error"); // Do not put details here at it appears on the user rendered html
|
||||
}
|
||||
}
|
||||
|
||||
@@ -483,7 +483,7 @@ LmsApplication::notify(const Wt::WEvent& event)
|
||||
catch (std::exception& e)
|
||||
{
|
||||
LMS_LOG(UI, ERROR) << "Caught exception: " << e.what();
|
||||
throw std::runtime_error("Internal error");
|
||||
throw LmsException("Internal error"); // Do not put details here at it appears on the user rendered html
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <Wt/WPushButton.h>
|
||||
#include <Wt/Auth/Identity.h>
|
||||
|
||||
#include "utils/Exception.hpp"
|
||||
#include "utils/Logger.hpp"
|
||||
|
||||
#include "common/Validators.hpp"
|
||||
@@ -58,7 +59,7 @@ class InitWizardModel : public Wt::WFormModel
|
||||
// Check if a user already exist
|
||||
// If it's the case, just do nothing
|
||||
if (!Database::User::getAll(LmsApp->getDboSession()).empty())
|
||||
throw std::runtime_error("Admin user already created");
|
||||
throw LmsException("Admin user already created");
|
||||
|
||||
// Create user
|
||||
Wt::Auth::User authUser = LmsApp->getDb().getUserDatabase().registerNew();
|
||||
|
||||
@@ -30,8 +30,9 @@
|
||||
#include <Wt/WStringListModel.h>
|
||||
|
||||
#include "common/Validators.hpp"
|
||||
#include "utils/Utils.hpp"
|
||||
#include "utils/Exception.hpp"
|
||||
#include "utils/Logger.hpp"
|
||||
#include "utils/Utils.hpp"
|
||||
|
||||
#include "LmsApplication.hpp"
|
||||
|
||||
@@ -79,7 +80,7 @@ class UserModel : public Wt::WFormModel
|
||||
Database::User::pointer user = LmsApp->getDb().getUser(authUser);
|
||||
|
||||
if (user == LmsApp->getUser())
|
||||
throw std::runtime_error("Cannot edit ourselves");
|
||||
throw LmsException("Cannot edit ourselves");
|
||||
|
||||
auto bitrate = getBitrateLimitRow(user->getMaxAudioBitrate());
|
||||
if (bitrate)
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <Wt/WApplication.h>
|
||||
#include <Wt/Http/Response.h>
|
||||
|
||||
#include "utils/Exception.hpp"
|
||||
#include "utils/Logger.hpp"
|
||||
#include "utils/Utils.hpp"
|
||||
|
||||
@@ -58,7 +59,7 @@ ImageResource::getDefaultCover(std::size_t size)
|
||||
Image::Image image;
|
||||
|
||||
if (!image.load( Wt::WApplication::instance()->docRoot() + unknownCoverPath ))
|
||||
throw std::runtime_error("Cannot read default cover file");
|
||||
throw LmsException("Cannot read default cover file");
|
||||
|
||||
image.scale(size);
|
||||
|
||||
@@ -80,7 +81,7 @@ ImageResource::getDefaultArtistImage(std::size_t size)
|
||||
Image::Image image;
|
||||
|
||||
if (!image.load( Wt::WApplication::instance()->docRoot() + unknownArtistImagePath))
|
||||
throw std::runtime_error("Cannot read default artist image file");
|
||||
throw LmsException("Cannot read default artist image file");
|
||||
|
||||
image.scale(size);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user