An exception explicitly thrown by Rack or a Rack plugin. Can be subclassed to throw/catch specific custom exceptions. */
| 211 | Can be subclassed to throw/catch specific custom exceptions. |
| 212 | */ |
| 213 | struct Exception : std::exception { |
| 214 | std::string msg; |
| 215 | |
| 216 | // Attribute index 1 refers to `Exception*` argument so use 2. |
| 217 | __attribute__((format(printf, 2, 3))) |
| 218 | Exception(const char* format, ...); |
| 219 | Exception(const std::string& msg) : msg(msg) {} |
| 220 | const char* what() const noexcept override { |
| 221 | return msg.c_str(); |
| 222 | } |
| 223 | }; |
| 224 | |
| 225 | |
| 226 | /** Given a std::map `c`, returns the value of the given key, or returns `def` if the key doesn't exist. |
no outgoing calls
no test coverage detected