Shamrock 2025.10.0
Astrophysical Code
Loading...
Searching...
No Matches
Classes | Namespaces | Typedefs | Functions
exception.hpp File Reference

This header file contains utility functions related to exception handling in the code. More...

#include "shambase/SourceLocation.hpp"
#include <stdexcept>
#include <string>
+ Include dependency graph for exception.hpp:

Go to the source code of this file.

Classes

class  shambase::scoped_exception_gen_callback
 Scoped exception generator callback. More...
 

Namespaces

namespace  shambase
 namespace for basic c++ utilities
 

Typedefs

using shambase::exception_gen_callback_t = void(*)(std::string msg)
 type of the exception generator callback
 

Functions

std::string shambase::exception_format (SourceLocation loc)
 Format the exception message with the source location information.
 
void shambase::set_exception_gen_callback (exception_gen_callback_t callback)
 Set the exception generator callback.
 
exception_gen_callback_t shambase::get_exception_gen_callback ()
 Get the current exception generator callback.
 
void shambase::exception_gen_callback (std::string msg)
 The callback called when an exception is thrown.
 
template<class ExcptTypes >
ExcptTypes shambase::make_except_with_loc (std::string message, SourceLocation loc=SourceLocation{})
 Create an exception with a message and a location.
 
template<class ExcptTypes >
void shambase::throw_with_loc (std::string message, SourceLocation loc=SourceLocation{})
 Throw an exception and append the source location to it.
 
void shambase::throw_unimplemented (SourceLocation loc=SourceLocation{})
 Throw a std::runtime_error saying that the function is unimplemented.
 
void shambase::throw_unimplemented (std::string message, SourceLocation loc=SourceLocation{})
 Throw a std::runtime_error with a message saying that the function is unimplemented.
 

Detailed Description

This header file contains utility functions related to exception handling in the code.

Author
Timothée David–Cléris (tim.s.nosp@m.hamr.nosp@m.ock@p.nosp@m.roto.nosp@m.n.me)

These functions are used to format the exception messages with the source location information.

Definition in file exception.hpp.