#pragma once #include #include #include namespace svapi { enum class ErrCode { BadRequest, Unauthorized, Forbidden, NotFound, Unprocessable, Unavailable, Internal }; int httpStatus(ErrCode code); nlohmann::json errorBody(const std::string& code, const std::string& message); struct ApiError : std::runtime_error { ErrCode code; std::string slug; ApiError(ErrCode c, std::string slug_, const std::string& msg) : std::runtime_error(msg), code(c), slug(std::move(slug_)) {} }; } // namespace svapi