Commit a8b42588 authored by Scott Wolchok's avatar Scott Wolchok Committed by Facebook Github Bot

Use throw_exception in DynamicConverter

Summary: Straightforward support for -fno-exceptions.

Reviewed By: yfeldblum

Differential Revision: D13289825

fbshipit-source-id: 4de867a77c758ce8a388fc8e0c85c296e86f3251
parent f4834763
......@@ -28,6 +28,7 @@
#include <folly/Optional.h>
#include <folly/Traits.h>
#include <folly/dynamic.h>
#include <folly/lang/Exception.h>
namespace folly {
template <typename T>
......@@ -110,7 +111,7 @@ struct Dereferencer {
static inline void derefToCache(
Optional<T>* /* mem */,
const dynamic::const_item_iterator& /* it */) {
throw TypeError("array", dynamic::Type::OBJECT);
throw_exception<TypeError>("array", dynamic::Type::OBJECT);
}
static inline void derefToCache(
......@@ -249,7 +250,7 @@ struct DynamicConverter<std::pair<F, S>> {
auto it = d.items().begin();
return std::make_pair(convertTo<F>(it->first), convertTo<S>(it->second));
} else {
throw TypeError("array (size 2) or object (size 1)", d.type());
throw_exception<TypeError>("array (size 2) or object (size 1)", d.type());
}
}
};
......@@ -271,7 +272,7 @@ struct DynamicConverter<
dynamicconverter_detail::conversionIterator<C>(d.items().begin()),
dynamicconverter_detail::conversionIterator<C>(d.items().end()));
} else {
throw TypeError("object or array", d.type());
throw_exception<TypeError>("object or array", d.type());
}
}
};
......@@ -295,7 +296,7 @@ struct DynamicConverter<
dynamicconverter_detail::conversionIterator<C>(d.items().begin()),
dynamicconverter_detail::conversionIterator<C>(d.items().end()));
} else {
throw TypeError("object or array", d.type());
throw_exception<TypeError>("object or array", d.type());
}
return ret;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment