SmartFoxServer 3 C++ Client API 3.1.0-beta
Client API for SmartFoxServer 3
Loading...
Searching...
No Matches
SFSErrorCodes.h File Reference

Doxygen only documents namespace-scope entities (enums, aliases, constants, free functions) in a header that carries this block. More...

#include <cstddef>
#include <cstdint>
#include <initializer_list>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>

Functions

std::unordered_map< int16_t, std::string > & sfs3::util::errorMessages ()
 Returns the mutable server-error-code -> message-template table.
void sfs3::util::setErrorMessage (int16_t code, std::string message)
 Sets (or adds) the message template for the given error code, mirroring the Java API's setErrorMessage.

Detailed Description

Doxygen only documents namespace-scope entities (enums, aliases, constants, free functions) in a header that carries this block.

Function Documentation

◆ errorMessages()

std::unordered_map< int16_t, std::string > & sfs3::util::errorMessages ( )
inline

Returns the mutable server-error-code -> message-template table.

Each template may contain "%s" positional placeholders that errorMessageFromCode() fills with runtime data. The table is seeded with the default English messages on first use; consumers may localize the API by editing it. For example, to translate a single message:

    sfs3::util::setErrorMessage(13, "Groupe demande indisponible - Salle: %s; Groupe: %s");

or to inject a whole translated set in one shot:

    sfs3::util::errorMessages() = std::move(myLocalizedTable);

Doing this through the API (rather than editing this header) means the customization survives future SDK source updates.

Returns
a reference to the single, program-wide message table

◆ setErrorMessage()

void sfs3::util::setErrorMessage ( int16_t code,
std::string message )
inline

Sets (or adds) the message template for the given error code, mirroring the Java API's setErrorMessage.

Use it to localize a single message; keep the "%s" placeholders so runtime parameters are still substituted.

Parameters
codethe server error code to override
messagethe new template, including any "%s" placeholders