Example #1
0
export function throw__invalid_argument(ctx, ...a1__ctx__error) {
	log(`${logPrefix}|throw__invalid_argument`)
	const ctx__error = clone(...a1__ctx__error)
	throw__error(
		ctx,
		{
			type: 'invalid_argument',
			error_message: `${ctx__error.key} is invalid`,
			status__http: 500,
			error_message__http: 'Error'
		},
		ctx__error)
}
Example #2
0
export function throw__missing_argument(ctx, ...a1__ctx__error) {
	log(`${logPrefix}|throw__missing_argument`)
	const ctx__error = clone(...a1__ctx__error)
	throw__error(
		ctx,
		{
			type: 'missing_argument',
			error_message: `${ctx__error.key} is not defined - ${ctx__error.type || 'Unknown Type'}`,
			status__http: 500,
			error_message__http: 'Error'
		},
		ctx__error)
}
Example #3
0
export function throw__invalid_state(ctx, ...a1__ctx__error) {
	log(`${logPrefix}|throw__invalid_state`)
	const ctx__error = clone(...a1__ctx__error)
	const reason =
		ctx__error.reason
		|| 'No reason given.'
	throw__error(
		ctx,
		{
			type: 'invalid_state',
			error_message: `${ctx__error.key} is in an invalid state. ${reason}`,
			status__http: 500,
			error_message__http: 'Error'
		},
		ctx__error)
}
Example #4
0
export function _script__drip(...ARR__opts) {
	log(`${logPrefix}|$script__drip`)
	const opts = clone(...ARR__opts)
	const DRIP_ID = opts.DRIP_ID || process.env.DRIP_ID
	if (!DRIP_ID) throw__missing_argument(opts, { key: 'process.env.DRIP_ID' })
	return `
	<script type="text/javascript">
		if (typeof window._dcq === 'undefined') {
			var _dcq = _dcq || [];
			var _dcs = _dcs || {};
			_dcs.account = '${DRIP_ID}';
		
			(function() {
				var dc = document.createElement('script');
				dc.type = 'text/javascript'; dc.async = true;
				dc.src = '//tag.getdrip.com/${DRIP_ID}.js';
				var s = document.getElementsByTagName('script')[0];
				s.parentNode.insertBefore(dc, s);
			})();			 
		}
	</script>`.trim()
}
Example #5
0
		__ => {
			const active__Sticky__Scroll = clone(__)
			active__Sticky__Scroll[key] = true
			return active__Sticky__Scroll
		})