Molybden API
|
Represents the JS function return value. More...
#include <js_return_value.hpp>
Public Member Functions | |
JsReturnValue (JsValue &&value) | |
JsReturnValue (JsError &&error) | |
JsReturnValue (JsReturnValue &&other) | |
void | operator= (JsReturnValue &&other) |
bool | isCorrect () const |
Indicates if the execution finished successfully and returned a value. | |
JsValue | asValue () && |
Returns the value that the return value represents if it does, otherwise it should not be called. | |
JsError | asError () && |
Returns the error that the return value represents if it does, otherwise it should not be called. | |
operator bool () const | |
Returns the result of isCorrect() . | |
Represents the JS function return value.
To unwrap the return value, check whether it is an error or the actual value, and then use std::move:
The JS function can either return value or throw an exception and this class represents these two possibilities.
bool molybden::JsReturnValue::isCorrect | ( | ) | const |
Indicates if the execution finished successfully and returned a value.
Use this method to determine whether to unwrap the object as a value or as an error.